Docker
The scaffold generates a docker-compose.yaml with optional services based on your choices during gocronx init.
Available Services
| Service | Port | When Included |
|---|---|---|
| Redis | 6379 | --redis flag or enabled in wizard |
| MySQL | 3306 | --db mysql |
| PostgreSQL | 5432 | --db postgres |
Usage
bash
# Start all configured services
docker compose up -d
# Start only Redis
docker compose up -d redis
# Stop all
docker compose down
# Stop and remove volumes
docker compose down -vDefault Credentials
| Service | User | Password | Database |
|---|---|---|---|
| MySQL | root | 123456 | (project name) |
| PostgreSQL | postgres | 123456 | (project name) |
| Redis | — | (none) | 0 |
WARNING
These are development defaults. Always change credentials for production.
Production Dockerfile
For production deployment, create a multi-stage Dockerfile:
dockerfile
# Build backend
FROM golang:1.23-alpine AS backend
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . .
RUN go build -o server ./cmd/server/
# Build frontend
FROM node:20-alpine AS frontend
WORKDIR /app/web
COPY web/package.json web/pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
COPY web/ .
RUN pnpm build
# Final image
FROM alpine:3.19
WORKDIR /app
COPY --from=backend /app/server .
COPY --from=frontend /app/web/dist ./web/dist
COPY config.yaml .
EXPOSE 8080
CMD ["./server"]