add container and go stuff

This commit is contained in:
XenGi 2024-01-22 12:37:28 +01:00
parent 8161b5d92b
commit cfaa05f7b5
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg
3 changed files with 50 additions and 1 deletions

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
FROM docker.io/golang:1.20 as builder
WORKDIR /app
COPY . ./
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o /sanic
# -----
FROM builder AS tester
RUN go test -v ./...
# -----
FROM scratch as runner
WORKDIR /
COPY --from=builder /sanic /sanic
COPY --from=builder /app/static /static
EXPOSE 8080
ENTRYPOINT ["/sanic"]