mirror of
https://github.com/renorris/openfsd
synced 2026-08-13 04:55:42 +08:00
Bump direct modules (gin, jwt, migrate, pq, envconfig, sqlite, x/crypto, x/net) and Go to 1.26 to clear Dependabot alerts and pick up current releases. Refresh Dockerfile base image and GitHub Actions majors.
31 lines
762 B
Docker
31 lines
762 B
Docker
FROM golang:1.26 AS build
|
|
|
|
WORKDIR /go/src/openfsd
|
|
COPY go.mod go.sum ./
|
|
|
|
# Cache module downloads
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
# Cache builds — single binary with both FSD and web services
|
|
ENV GOCACHE=/root/.cache/go-build
|
|
RUN --mount=type=cache,target="/root/.cache/go-build" \
|
|
CGO_ENABLED=0 go build -o /go/bin/openfsd ./cmd/openfsd
|
|
|
|
FROM alpine:latest
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/renorris/openfsd
|
|
|
|
RUN addgroup -g 2001 nonroot && \
|
|
adduser -u 2001 -G nonroot -D nonroot && \
|
|
mkdir /db && chown -R nonroot:nonroot /db
|
|
|
|
COPY --from=build --chown=nonroot:nonroot /go/bin/openfsd /
|
|
|
|
USER 2001:2001
|
|
|
|
# Default: run both FSD and web. Override CMD to pass e.g. only -fsd or only -web.
|
|
EXPOSE 6809 8000
|
|
CMD ["/openfsd"]
|