Skip to content

Commit f4ecc9b

Browse files
Switch to scratch on Dockerfile (#41)
1 parent 669187d commit f4ecc9b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Dockerfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
FROM golang:1.18-alpine
2-
3-
RUN apk add musl-dev
4-
RUN apk add libc-dev
5-
RUN apk add gcc
1+
FROM golang:1.19-alpine as build
62

73
WORKDIR /app
84

9-
COPY go.mod ./
10-
COPY go.sum ./
5+
COPY go.mod .
6+
COPY go.sum .
117

128
RUN go mod download
139

14-
COPY ./ /app
10+
COPY . .
11+
12+
ENV CGO_ENABLED=0
13+
14+
RUN go build -o anonymousoverflow
15+
16+
FROM scratch
1517

16-
RUN go build -o /anonymousoverflow
18+
COPY --from=build /app/anonymousoverflow /anonymousoverflow
19+
COPY templates /templates
20+
COPY public /public
21+
COPY --from=build /etc/ssl/certs /etc/ssl/certs
1722

1823
EXPOSE 8080
1924

0 commit comments

Comments
 (0)