Skip to content

Commit

Permalink
fix: use alpine to reduce image size
Browse files Browse the repository at this point in the history
  • Loading branch information
theredrad committed Apr 26, 2022
1 parent 703f9a0 commit c4ea78a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16
FROM golang:1.16 AS build

WORKDIR /app
COPY go.mod go.sum ./
Expand All @@ -9,5 +9,13 @@ COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -a -ldflags "-w -s" -o ./bin/lorem main.go

FROM alpine:3.15

WORKDIR /app

COPY --from=build /app/bin/lorem /app/lorem

USER 1000:1000

EXPOSE 8080
ENTRYPOINT ["./bin/lorem"]
ENTRYPOINT ["./lorem"]

0 comments on commit c4ea78a

Please sign in to comment.