ded1bb290b
- Removed the "/config" volume from the Dockerfile, simplifying the container's volume management.
40 lines
920 B
Docker
40 lines
920 B
Docker
FROM golang:1.25-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"]
|