Files
scratchbox/Dockerfile
T
s1d3sw1ped ad4355df17
CI / Go Tests (push) Successful in 15s
CI / Build (push) Successful in 9s
Format / gofmt (push) Successful in 7s
Release Artifacts / Validate release tag (push) Successful in 2s
Release Artifacts / Build and release executables (push) Successful in 15s
Release Artifacts / Build and release Docker image (push) Successful in 28s
Heavy security and file splitting
2026-06-01 20:15:28 -05:00

40 lines
922 B
Docker

FROM golang:1.25.4-alpine AS builder
WORKDIR /src
# Build-time dependencies for UI and Go compilation.
RUN apk add --no-cache nodejs npm
COPY go.mod go.sum ./
RUN go mod download
COPY web/ui/package.json web/ui/package-lock.json ./web/ui/
RUN npm --prefix ./web/ui ci
COPY . .
RUN npm --prefix ./web/ui run build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -tags "netgo osusergo" -ldflags "-s -w" \
-o /out/scratchbox ./cmd/scratchbox
FROM alpine:3.22
RUN addgroup -S scratchbox && adduser -S -G scratchbox scratchbox
WORKDIR /app
COPY --from=builder /out/scratchbox /usr/local/bin/scratchbox
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
mkdir -p /data /config && chown -R scratchbox:scratchbox /data /config
USER scratchbox
EXPOSE 8080
VOLUME ["/data"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]