mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
Server improvements: - Graceful shutdown with SIGTERM/SIGINT (10s grace period) - HTTP timeouts (ReadHeader 5s, Read 15s, Write 30s, Idle 60s) - Health endpoint now returns version and uptime Compose security hardening: - read_only filesystem, cap_drop ALL, no-new-privileges - Resource limits (2 CPU / 2G memory), tmpfs for /tmp - Playground healthcheck via /api/health New Docker images: - docker/production/ — lightweight debian-slim with tini, non-root user, healthcheck - docker/ci/ — minimal image for skill validation in pipelines - .github/workflows/docker-publish.yml — multi-arch GHCR publishing on tag push Script improvements: - DRY: test_docker.sh --online flag replaces duplicate test_docker_online.sh - _sandbox_common.sh: Compose v2 version check with install suggestions - .dockerignore: exclude website/, .github/, editor files New targets: - sandbox-status, dev-docker-up/down, docker-build, docker-build-multiarch Docs updated: CLAUDE.md, README.md, website docker guide with use cases
32 lines
1.0 KiB
Docker
32 lines
1.0 KiB
Docker
# CI Dockerfile — minimal image for skill validation in pipelines
|
|
# Usage: docker run ghcr.io/<org>/skillshare-ci audit /path/to/skills
|
|
# Build: docker build -f docker/ci/Dockerfile -t skillshare-ci .
|
|
|
|
# Stage 1: Build frontend assets
|
|
FROM node:22-bookworm-slim AS ui-builder
|
|
RUN npm install -g pnpm@latest
|
|
WORKDIR /ui
|
|
COPY ui/package.json ui/pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY ui/ ./
|
|
RUN pnpm run build
|
|
|
|
# Stage 2: Build Go binary
|
|
FROM golang:1.25.5-bookworm AS go-builder
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
COPY --from=ui-builder /ui/dist internal/server/dist/
|
|
ARG TARGETARCH=amd64
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
|
go build -trimpath -ldflags="-s -w" -o /skillshare ./cmd/skillshare
|
|
|
|
# Stage 3: Minimal CI runtime
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
COPY --from=go-builder /skillshare /usr/local/bin/skillshare
|
|
ENTRYPOINT ["skillshare"]
|