attempting to load from cache #32
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Build (Local) | |
| on: | |
| push: | |
| branches: [ '*' ] | |
| pull_request: | |
| branches: [ '*' ] | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| COMPOSE_DOCKER_CLI_BUILD: 1 | |
| COMPOSE_FILE: ./docker-compose.yml | |
| REGISTRY_PREFIX: docker.io/library | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set repository name | |
| id: repo | |
| run: echo "REPO_NAME=$(basename $GITHUB_WORKSPACE)" >> $GITHUB_ENV | |
| - name: Cache Docker images | |
| uses: actions/cache@v4 | |
| id: docker-cache | |
| with: | |
| path: | | |
| mongo.tar | |
| api.tar | |
| handler.tar | |
| ui.tar | |
| key: docker-local-images-${{ github.sha }} | |
| restore-keys: | | |
| docker-local-images- | |
| - name: Pull required images | |
| if: steps.docker-cache.outputs.cache-hit != 'true' | |
| run: docker compose -f ${{ env.COMPOSE_FILE }} pull | |
| - name: Build services | |
| if: steps.docker-cache.outputs.cache-hit != 'true' | |
| run: docker compose -f ${{ env.COMPOSE_FILE }} build | |
| - name: Save images | |
| if: steps.docker-cache.outputs.cache-hit != 'true' | |
| run: | | |
| # Save images to tar files | |
| docker save mongo > mongo.tar | |
| docker save ${REGISTRY_PREFIX}/${REPO_NAME}-api:latest > api.tar | |
| docker save ${REGISTRY_PREFIX}/${REPO_NAME}-handler:latest > handler.tar | |
| docker save ${REGISTRY_PREFIX}/${REPO_NAME}-ui:latest > ui.tar | |
| - name: Upload Docker images cache | |
| if: steps.docker-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| mongo.tar | |
| api.tar | |
| handler.tar | |
| ui.tar | |
| key: docker-images-${{ github.sha }} | |
| - name: Clean up | |
| if: always() | |
| run: docker system prune -f |