mirror of
https://github.com/restic/restic.git
synced 2025-11-03 03:41:30 +00:00
Directly build restic binary in release Docker container
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
FROM --platform=$BUILDPLATFORM alpine:latest as helper
|
||||
# the official binaries are cross-built from Linux running on an AMD64 host
|
||||
# other architectures also seem to generate identical binaries but stay on the safe side
|
||||
FROM --platform=linux/amd64 restic/builder:latest as helper
|
||||
|
||||
ARG VERSION
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
# add release binary for the appropriate platform
|
||||
COPY restic_${VERSION}_${TARGETOS}_${TARGETARCH}.bz2 /
|
||||
RUN apk add --update --no-cache bzip2
|
||||
RUN set -e && \
|
||||
bzcat restic_${VERSION}_${TARGETOS}_${TARGETARCH}.bz2 > restic && \
|
||||
chmod +x restic
|
||||
COPY . /restic
|
||||
RUN go run helpers/build-release-binaries/main.go --platform $TARGETOS/$TARGETARCH --skip-compress
|
||||
RUN mv /output/restic_${TARGETOS}_${TARGETARCH} /output/restic
|
||||
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=helper /restic /usr/bin
|
||||
COPY --from=helper /output/restic /usr/bin
|
||||
RUN apk add --update --no-cache ca-certificates fuse openssh-client tzdata jq
|
||||
|
||||
ENTRYPOINT ["/usr/bin/restic"]
|
||||
|
||||
Reference in New Issue
Block a user