Files
scratchbox/Dockerfile
T
s1d3sw1ped 34fd1a5a4d
CI / Go Tests (push) Failing after 26s
CI / Build (push) Successful in 15s
Format / gofmt (push) Successful in 5s
Add Docker support with Dockerfile, entrypoint script, and CI workflows
- Introduced a Dockerfile for building the application with Go and Node.js dependencies.
- Added a docker-entrypoint.sh script to manage container execution.
- Created a .dockerignore file to exclude unnecessary files from the Docker context.
- Updated Makefile to include a new target for building the Docker image.
- Added CI workflows for testing, formatting, and releasing artifacts in Gitea.
2026-06-01 02:03:17 -05:00

40 lines
931 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", "/config"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]