mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
- Add docker/sandbox/entrypoint.sh to auto-copy /ui-dist → internal/server/dist/ when missing, fixing the gitignore regression for all Docker workflows - Add scripts/_sandbox_common.sh with shared SCRIPT_DIR, PROJECT_ROOT, COMPOSE_FILE, and require_docker() function - Refactor all 5 sandbox scripts to source _sandbox_common.sh - Use YAML extension fields (x-sandbox-common) in docker-compose.sandbox.yml to eliminate duplicated service config - Break sandbox_playground_up.sh one-liner into readable steps, add skillshare-ui alias and init hint - Change test.sh to use `make build` for placeholder consistency
32 lines
913 B
Docker
32 lines
913 B
Docker
# 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: Go sandbox with pre-built frontend
|
|
FROM golang:1.25.5-bookworm
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends bash git ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy pre-built frontend for go:embed at build time
|
|
COPY --from=ui-builder /ui/dist /ui-dist
|
|
|
|
# Entrypoint copies /ui-dist → internal/server/dist/ when missing (fixes gitignore)
|
|
COPY docker/sandbox/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
WORKDIR /workspace
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
RUN mkdir -p /go/build-cache /go/pkg/mod && chmod -R 0777 /go/build-cache /go/pkg/mod
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["bash", "-c", "./scripts/test.sh"]
|