File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 11# Stage 1: Build the application
2- FROM golang:1.23-alpine AS builder
2+ FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS builder
33
44ARG VERSION
55ARG URL=https://github.com/LordPax/go-scan2epub
6+ ARG TARGETOS
7+ ARG TARGETARCH
68
79WORKDIR /app
810
11+ RUN mkdir /books
912RUN apk add --no-cache git && \
1013 git clone --branch ${VERSION} ${URL} . && \
1114 go mod download && \
12- go build -o scan2epub
15+ GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o scan2epub
1316
1417# Stage 2: Create the final lightweight image
1518FROM alpine:latest
1619
17- RUN apk add --no-cache ca-certificates
18-
1920WORKDIR /
2021
2122COPY --from=builder /app/scan2epub /scan2epub
22-
23- RUN mkdir books
24-
23+ COPY --from=builder /books /books
2524VOLUME ["/root/.config/scan2epub" , "/books" ]
2625
2726CMD ["/scan2epub" , "inter" ]
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33[ -z " $1 " ] && echo " Usage: $0 <version>" && exit 1
4+
45echo " Building version $1 "
5- docker build --build-arg VERSION=$1 -t lordpax/scan2epub:$1 -t lordpax/scan2epub:latest .
6- docker push lordpax/scan2epub:$1
7- docker push lordpax/scan2epub:latest
6+
7+ docker build \
8+ --platform linux/arm64,linux/amd64 \
9+ --build-arg VERSION=$1 \
10+ -t lordpax/scan2epub:$1 \
11+ -t lordpax/scan2epub:latest \
12+ --push .
13+
14+ [ $? -eq 0 ] && echo " Build successful" || echo " Build failed"
You can’t perform that action at this time.
0 commit comments