This commit is contained in:
lubiana 2025-07-28 19:54:33 +02:00
commit ad8c238e78
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
53 changed files with 10091 additions and 0 deletions

53
Containerfile Normal file
View file

@ -0,0 +1,53 @@
FROM node:22-alpine AS frontend-builder
WORKDIR /app
COPY frontend /app
RUN npm install
RUN npm run build
# Multi-stage build for GoCheck application
# Stage 1: Build the Go binary
FROM golang:1.24-alpine AS builder
# Install git, ca-certificates, and build tools for CGO
RUN apk add --no-cache git ca-certificates gcc musl-dev
# Set working directory
WORKDIR /app
# Copy go mod files
COPY backend/go.mod backend/go.sum ./
# Download dependencies
RUN go mod download
# Copy backend source code
COPY backend/ ./
# Create frontend directory and copy dist files
RUN mkdir -p frontend
COPY --from=frontend-builder /app/dist /app/frontend/dist
# Build the binary with embedded static files
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags="-s -w" -o gocheck .
# Stage 2: Create minimal runtime container
FROM alpine:latest
# Install runtime dependencies for SQLite
RUN apk add --no-cache ca-certificates sqlite
# Copy the binary from builder stage
COPY --from=builder /app/gocheck /app/gocheck
# Set working directory
WORKDIR /app
# Expose default port (can be overridden via PORT env var)
EXPOSE 8080
# Run the binary
ENTRYPOINT ["/app/gocheck"]