all repos — auth-boilerplate @ 9b74357216ccde9dafe9d4d3faa5e8ace72bab5b

A simple Go web-app boilerplate.

Dockerfile (view raw)

 1# syntax=docker/dockerfile:1
 2
 3FROM golang:1.23-alpine AS builder
 4
 5WORKDIR /build
 6
 7# Download Go modules
 8COPY go.mod go.sum ./
 9RUN go mod download
10RUN go mod verify
11
12# Transfer source code
13COPY src ./src
14COPY *.go ./
15
16# Build
17RUN CGO_ENABLED=0 go build -trimpath -o /dist/app
18
19
20# Test
21FROM builder AS run-test-stage
22COPY templates ./templates
23RUN go test -v ./...
24
25FROM scratch AS build-release-stage
26
27WORKDIR /app
28
29COPY static ./static
30COPY templates ./templates
31COPY --from=builder /dist .
32
33ENTRYPOINT ["./app"]