diff --git a/actions/serverless_prod_deploy/action.yml b/actions/serverless_prod_deploy/action.yml index d8e26ba1..c71f5fab 100644 --- a/actions/serverless_prod_deploy/action.yml +++ b/actions/serverless_prod_deploy/action.yml @@ -32,6 +32,13 @@ runs: shell: bash - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - name: Copy user code template file uses: dagster-io/dagster-cloud-action/actions/utils/copy_template@yuhan/08-07-use_--mount_type_cache_to_explicitly_cache_pip_downloads with: @@ -45,8 +52,12 @@ runs: tags: "${{ env.REGISTRY_URL }}:${{ github.sha }}" labels: | branch=${{ github.head_ref }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache - name: Deploy to Dagster Cloud uses: dagster-io/dagster-cloud-action/actions/utils/deploy@main id: deploy diff --git a/src/Dockerfile.template b/src/Dockerfile.template index b1de3ea3..c1593857 100644 --- a/src/Dockerfile.template +++ b/src/Dockerfile.template @@ -7,7 +7,7 @@ WORKDIR /opt/dagster/app COPY . /opt/dagster/app # Create caches for pip installs -RUN --mount=type=cache,target=/root/.cache/pip if [ -f "requirements.txt" ]; then \ +RUN --mount=type=cache,target=/tmp/.buildx-cache/.cache/pip if [ -f "requirements.txt" ]; then \ pip install -r requirements.txt; \ else \ pip install .; \