mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
Replace 4 independent schema management code paths (Docker shell script, setup wizard pg_restore, test helpers, manual psql) with a single migration runner embedded in the server binary. The new server/migrations/ package uses Go embed to bundle all SQL schemas. On startup, Migrate() creates a schema_version tracking table, detects existing databases (auto-marks baseline as applied), and runs pending migrations in transactions. Key changes: - Consolidated init.sql + 9.2-update + 33 patches into 0001_init.sql - Setup wizard simplified to single "Apply schema" checkbox - Test helpers use migrations.Migrate() instead of pg_restore - Docker no longer needs schema volume mounts or init script - Seed data (shops, events, gacha) embedded and applied via API - Future migrations just add 0002_*.sql files — no manual steps
31 lines
602 B
Docker
31 lines
602 B
Docker
# Build stage
|
|
FROM golang:1.25-alpine3.21 AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -o erupe-ce .
|
|
|
|
# Runtime stage
|
|
FROM alpine:3.21
|
|
|
|
RUN adduser -D -h /app erupe
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /build/erupe-ce .
|
|
|
|
# www/ and bin/ are mounted at runtime if needed
|
|
|
|
# bin/ and savedata/ are mounted at runtime via docker-compose
|
|
# config.json is also mounted at runtime
|
|
|
|
USER erupe
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
|
|
CMD wget -qO- http://localhost:8080/health || exit 1
|
|
|
|
ENTRYPOINT ["./erupe-ce"]
|