Skip to content

Commit

Permalink
enabled docker cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mathew-alex committed Jun 1, 2022
1 parent c8f5081 commit 8707449
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,34 @@ jobs:
steps:
- uses: actions/checkout@v3

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
# restore-keys: |
# ${{ runner.os }}-buildx-
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Test build
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: false
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Run tests
run: |
echo "running tests..."
# - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-staging:
needs: test
Expand All @@ -77,16 +77,16 @@ jobs:
flavor: |
latest=true
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
# restore-keys: |
# ${{ runner.os }}-buildx-
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('yarn.lock', '.yarnrc.yml', 'Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v2
Expand All @@ -108,13 +108,13 @@ jobs:
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

# - name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-production:
needs: test
Expand Down

0 comments on commit 8707449

Please sign in to comment.