30 lines
571 B
Docker
30 lines
571 B
Docker
# --- Build stage ---
|
|
FROM docker.io/library/golang:1.25-alpine AS build
|
|
|
|
RUN apk add --no-cache gcc musl-dev
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=1 go build \
|
|
-ldflags='-s -w -extldflags "-static"' \
|
|
-tags 'netgo,osusergo' \
|
|
-trimpath \
|
|
-o /horchposten .
|
|
|
|
# --- Runtime stage ---
|
|
FROM scratch
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=build /horchposten /horchposten
|
|
|
|
EXPOSE 8080
|
|
VOLUME /data
|
|
|
|
ENV DB_PATH=/data/analytics.db
|
|
ENV ADDR=:8080
|
|
|
|
ENTRYPOINT ["/horchposten"]
|