21 Commits

Author SHA1 Message Date
4473a55ea8 🔧 chore: merge docker-workflow-clean optimizations into move-docker-job
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 13s
CI/CD Pipeline / CI Pipeline (push) Successful in 6m13s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
2026-04-09 12:33:29 +02:00
6a295bccc9 🗑️ chore: Remove unnecessary Swagger cache steps from docker-push workflow 2026-04-09 12:22:13 +02:00
930e9ac159 🐛 fix: Simplify docker-push workflow using Attempt 2 approach 2026-04-09 12:21:52 +02:00
e27ed5b6ca 🐛 fix: Move WORKDIR before COPY in Dockerfile.build
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 52s
CI/CD Pipeline / CI Pipeline (push) Failing after 4m22s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
2026-04-09 12:19:40 +02:00
a9e2f08a28 🐳 Fix: Change Dockerfile.build WORKDIR to /build to avoid collision
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 1m58s
CI/CD Pipeline / CI Pipeline (push) Successful in 5m2s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
2026-04-09 11:57:25 +02:00
623f822fde 🐳 Fix: Avoid workspace collision by using different mount path 2026-04-09 11:56:27 +02:00
411e7210be 🐳 Debug: Use GITHUB_WORKSPACE and find go.mod 2026-04-09 11:55:54 +02:00
264c4fe7df 🐳 Debug: Check arcodange directory contents 2026-04-09 11:55:30 +02:00
c8d3e86986 🐳 Debug: Add ls and pwd to Swagger generation 2026-04-09 11:53:39 +02:00
f4b34b688d 🐳 Fix DEPS_HASH variable reference in docker run 2026-04-09 11:50:36 +02:00
ef1e5c0757 🐳 Add Swagger docs cache save step 2026-04-09 11:48:46 +02:00
706848c3d5 🐳 Attempt 3 (fixed): Add volume mount for Swagger docs generation 2026-04-09 11:45:47 +02:00
9f8b090164 🐳 Attempt 3 (fixed): Generate Swagger docs in Dockerfile 2026-04-09 11:40:24 +02:00
37f839009c 🐳 Attempt 3 (fixed): Add Swagger docs generation step 2026-04-09 11:38:36 +02:00
2404983627 🐳 Attempt 3 (fixed): Use --build-arg and ARG for DEPS_HASH 2026-04-09 11:35:43 +02:00
9937f814f6 🐳 Attempt 3 (fixed): Add COPY command for source code 2026-04-09 11:33:08 +02:00
ab9bdef81d 🐳 Attempt 3 (fixed): Export DEPS_HASH for inline Dockerfile 2026-04-09 11:31:19 +02:00
8ac9261a81 🐳 Attempt 3 (fixed): Inline version using prebuilt cache image 2026-04-09 11:31:06 +02:00
1843bc968f 🐳 Attempt 3: Inline version using prebuilt cache image 2026-04-09 11:27:45 +02:00
968d9956e9 🐳 Attempt 2: Use actual docker/Dockerfile (no inline) 2026-04-09 11:19:50 +02:00
3cafc7bcb2 🐳 Attempt 1: Inline version of docker/Dockerfile 2026-04-09 11:16:25 +02:00
2 changed files with 8 additions and 56 deletions

View File

@@ -41,68 +41,20 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.PACKAGES_TOKEN }} password: ${{ secrets.PACKAGES_TOKEN }}
- name: Calculate dependency hash
id: calc_hash
run: |
# Calculate dependency hash (same method as build-cache job)
DEPS_HASH=$(sha256sum go.mod go.sum docker/Dockerfile.build | sha256sum | cut -d' ' -f1 | head -c 12)
echo "Dependency hash: $DEPS_HASH"
echo "deps_hash=$DEPS_HASH" >> $GITHUB_OUTPUT
- name: Build and push Docker image - name: Build and push Docker image
run: | run: |
source VERSION source VERSION
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
# Use the calculated dependency hash
DEPS_HASH="${{ steps.calc_hash.outputs.deps_hash }}"
echo "Using dependency hash: $DEPS_HASH"
TAGS="$IMAGE_VERSION latest ${{ github.sha }}" TAGS="$IMAGE_VERSION latest ${{ github.sha }}"
echo "Building Docker image with tags: $TAGS" echo "Building Docker image with tags: $TAGS"
# Build the production image using inline Dockerfile # Build using the standard Dockerfile (Attempt 2 - simplest approach)
docker build -t dance-lessons-coach -f - . <<'EOF' docker build -t dance-lessons-coach -f docker/Dockerfile .
# dance-lessons-coach Production Docker Image
# Inline Dockerfile - no template needed
# Use the build cache image as base
FROM gitea.arcodange.lab/arcodange/dance-lessons-coach-build-cache:${DEPS_HASH} AS builder
# Set working directory and build the binary
WORKDIR /workspace
RUN go build -o dance-lessons-coach ./cmd/server
# Final minimal image
FROM alpine:3.18
WORKDIR /app
# Install minimal dependencies
RUN apk add --no-cache ca-certificates tzdata
# Copy binary from builder
COPY --from=builder /workspace/dance-lessons-coach /app/dance-lessons-coach
# Copy configuration
COPY config.yaml /app/config.yaml
# Set permissions
RUN chmod +x /app/dance-lessons-coach
# Set timezone
ENV TZ=UTC
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget -q --spider http://localhost:8080/api/health || exit 1
# Entry point
ENTRYPOINT ["/app/dance-lessons-coach"]
EOF
for TAG in $TAGS; do for TAG in $TAGS; do
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG" IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"

View File

@@ -32,12 +32,12 @@ RUN go install github.com/swaggo/swag/cmd/swag@latest && \
go install golang.org/x/tools/cmd/goimports@latest && \ go install golang.org/x/tools/cmd/goimports@latest && \
go install honnef.co/go/tools/cmd/staticcheck@latest go install honnef.co/go/tools/cmd/staticcheck@latest
# Simple build environment - source code is mounted at runtime
WORKDIR /build
# Copy only go.mod and go.sum first for dependency caching # Copy only go.mod and go.sum first for dependency caching
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download && go mod verify 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) # Pre-download common Go tools (already installed in base)
# RUN go install github.com/swaggo/swag/cmd/swag@latest # RUN go install github.com/swaggo/swag/cmd/swag@latest