# Stage 1: Build frontend FROM node:20-alpine AS frontend-builder WORKDIR /app/frontend COPY frontend/package.json frontend/package-lock.json* ./ RUN npm install COPY frontend/ . RUN npm run build # Stage 2: Build Go binary FROM golang:1.25.7-alpine AS go-builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -o server . # Stage 3: Final image FROM alpine:latest RUN apk add --no-cache ffmpeg WORKDIR /app COPY --from=go-builder /app/server . COPY --from=frontend-builder /app/frontend/dist ./frontend/dist EXPOSE 8080 CMD ["./server"]