Skip to content

Commit

Permalink
fix: build static binary
Browse files Browse the repository at this point in the history
  • Loading branch information
meysam81 committed Feb 7, 2024
1 parent 88a4148 commit c01133c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ ARG ALPINE_VERSION=3.19
ARG TARGETARCH

FROM golang:$GO_VERSION-alpine$ALPINE_VERSION as build
ENV GOARCH=$TARGETARCH GOOS=linux
ENV GOARCH=$TARGETARCH GOOS=linux CGO_ENABLED=0
WORKDIR /azcopy
ARG AZCOPY_VERSION
RUN apk add --no-cache build-base
RUN wget "https://github.com/Azure/azure-storage-azcopy/archive/v$AZCOPY_VERSION.tar.gz" -O src.tgz || wget "https://github.com/Azure/azure-storage-azcopy/archive/$AZCOPY_VERSION.tar.gz" -O src.tgz
RUN tar xf src.tgz --strip 1 \
&& go build -o azcopy \
&& ./azcopy --version
&& go build -o azcopy \
&& ./azcopy --version

FROM alpine:$ALPINE_VERSION as release
ARG AZCOPY_VERSION
LABEL name="docker-azcopy"
LABEL version="$AZCOPY_VERSION"
LABEL maintainer="Meysam <[email protected]>"
COPY --from=build /azcopy/azcopy /usr/local/bin
WORKDIR /WORKDIR
COPY --from=build /azcopy/azcopy /usr/local/bin/
CMD [ "azcopy" ]

0 comments on commit c01133c

Please sign in to comment.