Skip to content

Commit

Permalink
feat: add cache build and build args
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson2427 committed Aug 15, 2024
1 parent 963117a commit 69e7270
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}-slim
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max

- name: Build and push
uses: docker/build-push-action@v4
Expand All @@ -62,5 +64,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
build-args: |
SLIM_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-slim
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# See LICENSE in the project root for license information.
#---------------------------------------------------------------------------------------------

ARG SLIM_IMAGE
ARG PYTHON_VERSION="3.11"
FROM python:${PYTHON_VERSION} as builder
FROM python:${PYTHON_VERSION} AS builder

WORKDIR /wheels

Expand All @@ -16,7 +17,7 @@ COPY ./recommended-plugins.txt ./recommended-plugins.txt

RUN pip wheel .[recommended-plugins] --wheel-dir=/wheels

FROM ape:latest-slim
FROM ${SLIM_IMAGE}

USER root

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

ARG PYTHON_VERSION="3.11"

FROM python:${PYTHON_VERSION} as builder
FROM python:${PYTHON_VERSION} AS builder

WORKDIR /wheels

Expand Down

0 comments on commit 69e7270

Please sign in to comment.