Skip to content

Commit

Permalink
feat: multi-stage build
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Jul 25, 2024
1 parent 5a84cf8 commit 6fe6a71
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
FROM golang:1.22.5
# syntax=docker/dockerfile:1
FROM golang:1.22.5 AS build

WORKDIR /src
COPY . .

RUN go build && touch .env
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/lcp ./main.go && touch .env

CMD ["./lcp-v2"]
RUN ls -l /bin/lcp

FROM alpine

RUN apk add --no-cache ca-certificates

COPY --from=build /bin/lcp /bin/lcp
COPY --from=build /src/.env ./.env

CMD ["/bin/lcp"]

0 comments on commit 6fe6a71

Please sign in to comment.