bump go to 1.22.0; add container setup

use a multistage build so we don't leave the source code on the final artifact.
This commit is contained in:
tamsin woo 2024-02-24 21:28:41 -08:00
parent 9c857694ab
commit 5a5d8b7909
2 changed files with 17 additions and 1 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
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"]

2
go.mod
View File

@ -1,6 +1,6 @@
module replication-systems.estradiol.cloud module replication-systems.estradiol.cloud
go 1.21.4 go 1.22.0
require ( require (
github.com/julienschmidt/httprouter v1.3.0 github.com/julienschmidt/httprouter v1.3.0