Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# Stage 1: Build Frontend
FROM node:22-alpine AS frontend-builder
# Stage 1: Build Frontend (architecture-independent)
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend-builder
WORKDIR /app
COPY app/package.json app/yarn.lock* app/package-lock.json* ./
RUN npm install
COPY app .
# Allow setting API URL at build time, default to relative for same-origin serving
ENV NEXT_PUBLIC_API_URL=""
RUN npm run build

# Stage 2: Build Backend
FROM golang:1.25-alpine AS backend-builder
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS backend-builder
WORKDIR /app
RUN apk add --no-cache git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o server cmd/main.go
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o server cmd/main.go

# Stage 3: Final Image
FROM alpine:3.23.0
WORKDIR /app
RUN apk --no-cache add ca-certificates

COPY --from=backend-builder /app/server .
# Copy static frontend files to ./public which the Go server expects
COPY --from=frontend-builder /app/out ./public

EXPOSE 8081
Expand Down