Switch to scratch on Dockerfile (#41)

This commit is contained in:
Baalaji 2023-08-21 11:34:45 +05:30 committed by GitHub
parent 669187dd4d
commit f4ecc9be6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,19 +1,24 @@
FROM golang:1.18-alpine
RUN apk add musl-dev
RUN apk add libc-dev
RUN apk add gcc
FROM golang:1.19-alpine as build
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY ./ /app
COPY . .
RUN go build -o /anonymousoverflow
ENV CGO_ENABLED=0
RUN go build -o anonymousoverflow
FROM scratch
COPY --from=build /app/anonymousoverflow /anonymousoverflow
COPY templates /templates
COPY public /public
COPY --from=build /etc/ssl/certs /etc/ssl/certs
EXPOSE 8080