Skip to content

Commit

Permalink
Revert "Revert "ARMでもAMD64でも使えるDockerfileに""
Browse files Browse the repository at this point in the history
This reverts commit 4f67086.
  • Loading branch information
Drumato committed Apr 17, 2024
1 parent 4f67086 commit c54347a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@ ARG OYAKI_VERSION
WORKDIR /go/src/oyaki
COPY . /go/src/oyaki

RUN CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=${OYAKI_VERSION}" -o /go/bin/oyaki
RUN apt update && apt install -y curl \
&& curl https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1-linux-x86-64.tar.gz --output libwebp.tar.gz \
&& tar vzxf libwebp.tar.gz \
&& mv libwebp-1.3.1-linux-x86-64/bin/cwebp /go/bin/
ARG TARGETARCH
ENV LIBWEBP_VERSION=1.3.1
ENV BASE_URL=https://storage.googleapis.com/downloads.webmproject.org/releases/webp
RUN apt-get update && apt-get install -y curl tar
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
ARCH='amd64'; \
elif [ "${TARGETARCH}" = "arm64" ]; then \
ARCH='aarch64'; \
else \
echo "Unsupported arch: ${TARGETARCH}"; exit 1; \
fi && \
curl https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.1-linux-${ARCH}.tar.gz --output libwebp.tar.gz \
tar -zxf libwebp.tar.gz --strip-components=1 -C /go/bin && \
rm libwebp.tar.gz

RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -ldflags "-s -w -X main.version=${OYAKI_VERSION}" -o /go/bin/oyaki

FROM gcr.io/distroless/static-debian11

Expand Down

0 comments on commit c54347a

Please sign in to comment.