Skip to content

Commit

Permalink
Shrunk Docker image by using a builder (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
aunefyren authored Dec 20, 2023
1 parent a52c247 commit 6b2732c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
FROM golang:1.20.3-bullseye
FROM golang:1.20.4-bullseye as builder

ARG TARGETARCH
ARG TARGETOS
ARG TARGETARCH
ARG TARGETOS
ENV port=8282

LABEL org.opencontainers.image.source=https://github.com/aunefyren/wrapperr

WORKDIR /app

COPY . .

RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build

FROM debian:bullseye-slim as runtime

LABEL org.opencontainers.image.source=https://github.com/aunefyren/wrapperr

WORKDIR /app

COPY --from=builder /app .

EXPOSE ${port}

Expand Down

0 comments on commit 6b2732c

Please sign in to comment.