tamsin woo
5a5d8b7909
use a multistage build so we don't leave the source code on the final artifact.
16 lines
333 B
Docker
16 lines
333 B
Docker
FROM golang:1.22.0-alpine3.19 as build
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download && go mod verify
|
|
|
|
COPY . .
|
|
RUN go build -v -o /tmp/app ./cmd/web
|
|
|
|
|
|
FROM golang:1.22.0-alpine3.19
|
|
ENV LOGFMT=json LOGLEVEL=DEBUG
|
|
COPY --from=build /tmp/app /
|
|
EXPOSE 4000
|
|
CMD ["sh", "-c", "/app -logfmt=$LOGFMT -loglevel=$LOGLEVEL"] |