Added Docker build infrastructure: - Multi-stage build (builder, cache, production) - Dependency hashing for cache invalidation - GNU tar support for cache compatibility - Production and development Dockerfiles - Docker Compose for local development Build Optimization: - Dependency-based cache keys - Layer caching strategy - Cross-platform compatibility - Gitea Actions cache integration Files Added: - docker/Dockerfile.build - Build environment - docker/Dockerfile.prod - Production image - docker/Dockerfile.prod.template - Template-based generation - docker-compose.yml - Development setup - scripts/calculate-deps-hash.sh - Cache key calculation - scripts/test-docker-cache.sh - Cache testing Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
43 lines
1.1 KiB
Docker
43 lines
1.1 KiB
Docker
# Build environment Dockerfile with pre-installed Go tools and dependencies
|
|
# Optimized for CI/CD pipeline speed
|
|
# Updated to include Node.js for GitHub Actions compatibility
|
|
|
|
FROM golang:1.26.1-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache \
|
|
git \
|
|
bash \
|
|
curl \
|
|
make \
|
|
gcc \
|
|
musl-dev \
|
|
bc \
|
|
grep \
|
|
sed \
|
|
jq \
|
|
ca-certificates \
|
|
nodejs \
|
|
npm \
|
|
postgresql-client \
|
|
tar # Add GNU tar for cache compatibility
|
|
|
|
# Set up Go environment
|
|
ENV GOPATH=/go
|
|
ENV PATH=$GOPATH/bin:/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin
|
|
WORKDIR /go/src/dance-lessons-coach
|
|
|
|
# Install common Go tools
|
|
RUN go install github.com/swaggo/swag/cmd/swag@latest && \
|
|
go install golang.org/x/tools/cmd/goimports@latest && \
|
|
go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
# Copy only go.mod and go.sum first for dependency caching
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download && go mod verify
|
|
|
|
# Simple build environment - source code is mounted at runtime
|
|
WORKDIR /workspace
|
|
|
|
# Pre-download common Go tools (already installed in base)
|
|
# RUN go install github.com/swaggo/swag/cmd/swag@latest |