ci: run only lint and tests on main, build images on tags and test branches
MindSift CI & Docker Release / Lint, Build & Unit Tests (push) Successful in 3m14s
MindSift CI & Docker Release / Build & Push Docker Image (push) Skipped

This commit is contained in:
sandrodach committed 2026-10-24 17:30:05 +02:00
1 parent 84bc6884b0
commit 3081397fc1
3 files changed
+40 -19

No files matched your search

+7 -5
View File
@@ -1,7 +1,7 @@
# ==============================================================================
# Stage 1: Frontend Build (React + TypeScript + Vite + Tailwind CSS)
# Stage 1: Frontend Build (Runs natively on $BUILDPLATFORM — zero QEMU overhead)
# ==============================================================================
FROM node:22-alpine AS frontend-builder
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install --no-audit --no-fund
@@ -9,9 +9,11 @@ COPY frontend/ ./
RUN npm run build
# ==============================================================================
# Stage 2: Go Backend Build (Single Static Binary with embed.FS)
# Stage 2: Go Backend Build (Native Cross-Compile via TARGETOS / TARGETARCH)
# ==============================================================================
FROM golang:1.23-alpine AS backend-builder
FROM --platform=$BUILDPLATFORM golang:1.23-alpine AS backend-builder
ARG TARGETOS=linux
ARG TARGETARCH=amd64
WORKDIR /app
RUN apk add --no-cache git ca-certificates
COPY go.mod ./
@@ -21,7 +23,7 @@ COPY migrations/ ./migrations/
# Copy compiled frontend SPA assets into cmd/server/dist for go:embed
COPY --from=frontend-builder /app/frontend/dist ./cmd/server/dist
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/mindsift ./cmd/server
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /app/mindsift ./cmd/server
# ==============================================================================
# Stage 3: Minimal Production Runtime (< 35 MB)