Configuration & Manifests
Production Dockerfile specifications, GitHub Actions workflow definitions, and Kubernetes Helm values.
Container Specification
Multi-Stage Distroless Dockerfile
The first build stage uses golang:1.21-alpine to download modules and compile a static Go binary with CGO disabled.
The second stage copies only the compiled binary into gcr.io/distroless/static-debian11. The container runs under a non-root user (UID 65532) with no shell access.
# Stage 1: Build FROM golang:1.21-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /pipelineforge ./cmd/server # Stage 2: Distroless Runtime FROM gcr.io/distroless/static-debian11:nonroot WORKDIR / COPY --from=builder /pipelineforge /pipelineforge USER nonroot:nonroot EXPOSE 8080 ENTRYPOINT ["/pipelineforge"]
CI/CD Automation
GitHub Actions Security Pipeline
Every push triggers unit tests and linting. Once tests pass, the action builds the container image and runs Trivy in severity mode.
If Trivy finds any High or Critical vulnerabilities, the job halts. Only passing images are tagged and pushed to the container registry for Helm deployment.
name: Build, Scan & Deploy
on:
push:
branches: [ main ]
jobs:
pipeline:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Local Image
run: docker build -t pipelineforge:${{ github.sha }} .
- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'pipelineforge:${{ github.sha }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'HIGH,CRITICAL'
- name: Deploy via Helm
run: |
helm upgrade --install pipelineforge ./helm/pipelineforge \
--set image.tag=${{ github.sha }} \
--namespace prodCluster Manifests
Kubernetes Hardening & Helm Values
The Helm chart sets strict container security contexts: read-only root filesystems, dropping all Linux capabilities, and disallowing privilege escalation.
Horizontal Pod Autoscalers scale pods between 2 and 8 replicas based on CPU target thresholds, while readiness and liveness probes ensure zero-downtime rolling updates.
replicaCount: 2
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65532
capabilities:
drop: ["ALL"]
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 50m
memory: 64Mi
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 8
targetCPUUtilizationPercentage: 70