mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-05 13:29:44 +02:00
Add a one-command self-hosting setup: `docker compose -f docker-compose.selfhost.yml up -d` starts PostgreSQL, backend (with auto-migration), and frontend. Changes: - docker-compose.selfhost.yml: full stack orchestration (postgres + backend + frontend) - Dockerfile: add entrypoint.sh that auto-runs migrations before server start - Dockerfile.web: multi-stage Next.js build with standalone output - docker/entrypoint.sh: migration + server startup script - .dockerignore: exclude unnecessary files from Docker builds - apps/web/next.config.ts: conditional standalone output for Docker builds - SELF_HOSTING.md: rewrite with Docker Compose as primary approach - README.md: update self-host section Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
982 B
Docker
39 lines
982 B
Docker
# --- Build stage ---
|
|
FROM golang:1.26-alpine AS builder
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /src
|
|
|
|
# Cache dependencies
|
|
COPY server/go.mod server/go.sum ./server/
|
|
RUN cd server && go mod download
|
|
|
|
# Copy server source
|
|
COPY server/ ./server/
|
|
|
|
# Build binaries
|
|
ARG VERSION=dev
|
|
ARG COMMIT=unknown
|
|
RUN cd server && CGO_ENABLED=0 go build -ldflags "-s -w" -o bin/server ./cmd/server
|
|
RUN cd server && CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT}" -o bin/multica ./cmd/multica
|
|
RUN cd server && CGO_ENABLED=0 go build -ldflags "-s -w" -o bin/migrate ./cmd/migrate
|
|
|
|
# --- Runtime stage ---
|
|
FROM alpine:3.21
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /src/server/bin/server .
|
|
COPY --from=builder /src/server/bin/multica .
|
|
COPY --from=builder /src/server/bin/migrate .
|
|
COPY server/migrations/ ./migrations/
|
|
COPY docker/entrypoint.sh .
|
|
RUN chmod +x entrypoint.sh
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|