1# syntax=docker/dockerfile:1
2
3FROM golang:1.22-alpine AS builder
4RUN apk add --no-cache git make sassc
5
6WORKDIR /build
7
8# Download Git submodules
9COPY .git ./.git
10RUN git submodule update --init --recursive
11
12# Download Go modules
13COPY go.mod go.sum ./
14RUN go mod download
15RUN go mod verify
16
17# Transfer source code
18COPY Makefile .
19COPY scss ./scss
20COPY static ./static
21COPY templates ./templates
22COPY *.go ./
23COPY pkg ./pkg
24
25# Build
26RUN make
27
28FROM scratch AS build-release-stage
29
30WORKDIR /app
31
32COPY --from=builder /build/cerrado .
33COPY contrib/config.docker.scfg /etc/cerrado.scfg
34
35ENTRYPOINT ["./cerrado"]