Skip to content

Commit c4ea78a

Browse files
committedApr 26, 2022
fix: use alpine to reduce image size
1 parent 703f9a0 commit c4ea78a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎Dockerfile

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.16
1+
FROM golang:1.16 AS build
22

33
WORKDIR /app
44
COPY go.mod go.sum ./
@@ -9,5 +9,13 @@ COPY . .
99

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

12+
FROM alpine:3.15
13+
14+
WORKDIR /app
15+
16+
COPY --from=build /app/bin/lorem /app/lorem
17+
18+
USER 1000:1000
19+
1220
EXPOSE 8080
13-
ENTRYPOINT ["./bin/lorem"]
21+
ENTRYPOINT ["./lorem"]

0 commit comments

Comments
 (0)