mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-06-28 03:03:24 +00:00
perf: build frontend once on runner instead of in Docker
- [x] Remove Docker compilation from server, scanner, migrate Dockerfiles - [x] Use pre-built binaries injected by GoReleaser instead - [x] Delete separate gateway container and merge into frontend - [x] Update .goreleaser.yaml to reference pre-built binaries - [x] Simplify Kubernetes deployment to remove gateway service - [x] Simplify docker-compose to remove gateway container - [x] Add backend proxy configuration to frontend
This commit is contained in:
+8
-44
@@ -1,47 +1,7 @@
|
||||
# Migration Engine - Database Migration Tool
|
||||
# Multi-stage build to compile with CGO support
|
||||
# This Dockerfile expects a PRE-BUILT binary from GoReleaser (no compilation)
|
||||
# GoReleaser injects the platform-specific binary automatically
|
||||
|
||||
# Build stage
|
||||
# Let buildx handle platform automatically
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
# Get build platform from buildx
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
# Install build dependencies for CGO
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
sqlite-dev \
|
||||
git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build with CGO enabled
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
ARG BUILD_TIME=unknown
|
||||
|
||||
RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||
go build -ldflags="-s -w \
|
||||
-X main.Version=${VERSION} \
|
||||
-X main.GitCommit=${GIT_COMMIT} \
|
||||
-X main.BuildTime=${BUILD_TIME}" \
|
||||
-o migrate ./cmd/migrate
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
# Install runtime dependencies (including CGO/SQLite dependencies)
|
||||
@@ -58,10 +18,14 @@ RUN apk add --no-cache \
|
||||
RUN addgroup -g 1000 gohoarder && \
|
||||
adduser -D -u 1000 -G gohoarder gohoarder
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/migrate /usr/local/bin/migrate
|
||||
# Copy pre-built binary from GoReleaser
|
||||
# GoReleaser will automatically inject the correct binary for the target platform
|
||||
COPY migrate /usr/local/bin/migrate
|
||||
RUN chmod +x /usr/local/bin/migrate
|
||||
|
||||
# Copy migration SQL files
|
||||
COPY migrations /migrations
|
||||
|
||||
WORKDIR /app
|
||||
USER gohoarder
|
||||
|
||||
|
||||
Reference in New Issue
Block a user