🔧 fix: optimize Docker cache usage by removing redundant go mod tidy
- Remove unnecessary go mod tidy execution when using Docker cache - Dependencies are already pre-installed in the cache image - Only run go mod tidy when not using cache (native execution) - This leverages the true purpose of the Docker build cache Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -177,13 +177,13 @@ jobs:
|
|||||||
echo "CACHE_AVAILABLE=false" >> $GITHUB_ENV
|
echo "CACHE_AVAILABLE=false" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Check dependencies
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ env.CACHE_AVAILABLE }}" = "true" ]; then
|
if [ "${{ env.CACHE_AVAILABLE }}" = "true" ]; then
|
||||||
echo "Running in Docker Compose container..."
|
echo "✅ Using pre-installed dependencies from Docker cache"
|
||||||
docker compose -f docker-compose.build.yml exec -w /workspace build-cache sh -c "go mod tidy"
|
# No need to run go mod tidy - dependencies are already in the cache
|
||||||
else
|
else
|
||||||
echo "Running natively..."
|
echo "Running natively - ensuring dependencies are up to date..."
|
||||||
go mod tidy
|
go mod tidy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -85,16 +85,16 @@ else
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 5. Install dependencies
|
# 5. Check dependencies
|
||||||
echo "5. Installing dependencies..."
|
echo "5. Checking dependencies..."
|
||||||
if [ "$USE_DOCKER_CACHE" = true ]; then
|
if [ "$USE_DOCKER_CACHE" = true ]; then
|
||||||
echo "Running in Docker Compose container..."
|
echo "✅ Using pre-installed dependencies from Docker cache"
|
||||||
docker compose -f docker-compose.build.yml exec -w /workspace build-cache sh -c "go mod tidy"
|
# No need to run go mod tidy - dependencies are already in the cache
|
||||||
else
|
else
|
||||||
echo "Running natively..."
|
echo "Running natively - ensuring dependencies are up to date..."
|
||||||
go mod tidy
|
go mod tidy
|
||||||
fi
|
fi
|
||||||
echo "✅ Dependencies installed"
|
echo "✅ Dependencies ready"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# 6. Generate Swagger Docs
|
# 6. Generate Swagger Docs
|
||||||
|
|||||||
Reference in New Issue
Block a user