From 7a7b4af5f726ebd78ebd01b8d1d7688645a625a2 Mon Sep 17 00:00:00 2001 From: "Xuan (Sean) Hu" Date: Fri, 24 May 2024 13:25:04 +0800 Subject: [PATCH] ci: test container before push (#528) --- .github/workflows/ci.yml | 8 +-- .github/workflows/devcontainer.yml | 60 ++++++++++++++----- .github/workflows/release.yml | 28 ++++++++- .gitlab/workflows/devcontainer.yml | 19 +++++- .gitlab/workflows/release.yml | 27 ++++++++- .../workflows/ci.yml.jinja | 8 +-- .../workflows/devcontainer.yml.jinja | 60 ++++++++++++++----- .../workflows/release.yml.jinja | 28 ++++++++- .../workflows/devcontainer.yml.jinja | 19 +++++- .../workflows/release.yml.jinja | 27 ++++++++- 10 files changed, 226 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 326c7d25..a60cc2c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,6 @@ name: CI on: pull_request: - types: - - opened - - synchronize push: branches: - main @@ -28,10 +25,7 @@ jobs: version: 2.15.2 - run: env | sort - run: make dev - - run: make lint - - run: make test - - run: make doc - - run: make build + - run: make lint test doc build strategy: matrix: os: diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 0d72f552..9b574802 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -1,13 +1,31 @@ name: DevContainer + +on: + pull_request: + paths: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .github/workflows/devcontainer.yml + push: + branches: + - main + paths: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .github/workflows/devcontainer.yml + workflow_dispatch: null + concurrency: cancel-in-progress: true group: ${{ github.workflow }}-${{ github.ref }} + jobs: dev-container-publish: permissions: packages: write runs-on: ubuntu-22.04 steps: + - run: env | sort - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io - run: | @@ -18,26 +36,38 @@ jobs: docker buildx build . \ --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ --cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ + --target dev + - run: | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ + make dev lint test doc build + - run: | + docker buildx build . \ + --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \ + --target prod + - run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} + - if: github.event_name != 'pull_request' + run: | + docker buildx build . \ + --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ --cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ --target dev strategy: matrix: python-version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" -on: - push: - branches: - - main - paths: - - .devcontainer/Dockerfile - - .devcontainer/Dockerfile.dockerignore - - .github/workflows/devcontainer.yml - workflow_dispatch: null + - '3.8' + - '3.9' + - '3.10' + - '3.11' + - '3.12' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04e82577..0856b17d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,6 +44,7 @@ jobs: packages: write runs-on: ubuntu-22.04 steps: + - run: env | sort - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io - run: | @@ -54,9 +55,22 @@ jobs: docker buildx build . \ --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ --cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ + --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \ + --target dev + - run: | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ + make dev lint test doc build + - run: | + docker buildx build . \ + --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ --cache-to type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }} \ --tag ghcr.io/${{ github.repository }}/dev:py${{ matrix.python-version }}-${{ github.ref_name }} \ @@ -65,9 +79,17 @@ jobs: docker buildx build . \ --build-arg SCM_VERSION=${{ github.ref_name }} \ --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ - --cache-from type=registry,ref=ghcr.io/${{ github.repository }}/dev-cache:py${{ matrix.python-version }} \ --file .devcontainer/Dockerfile \ - --provenance false \ + --load \ + --tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \ + --tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} \ + --target prod + - run: docker run --rm ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} + - run: | + docker buildx build . \ + --build-arg SCM_VERSION=${{ github.ref_name }} \ + --build-arg PYTHON_VERSION=${{ matrix.python-version }} \ + --file .devcontainer/Dockerfile \ --push \ --tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }} \ --tag ghcr.io/${{ github.repository }}:py${{ matrix.python-version }}-${{ github.ref_name }} \ diff --git a/.gitlab/workflows/devcontainer.yml b/.gitlab/workflows/devcontainer.yml index ad2f895d..fe4b3ea2 100644 --- a/.gitlab/workflows/devcontainer.yml +++ b/.gitlab/workflows/devcontainer.yml @@ -15,6 +15,11 @@ dev-container-publish: - .gitlab/workflows/devcontainer.yml if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" + - changes: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .gitlab/workflows/devcontainer.yml + if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - docker context create builder @@ -24,9 +29,21 @@ dev-container-publish: docker buildx build . \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + --target dev + - | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + make dev lint test doc build + - | + docker buildx build . \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ --target dev diff --git a/.gitlab/workflows/release.yml b/.gitlab/workflows/release.yml index 4e054b03..5f099bc9 100644 --- a/.gitlab/workflows/release.yml +++ b/.gitlab/workflows/release.yml @@ -50,9 +50,22 @@ container-publish: docker buildx build . \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ + --target dev + - | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + make dev lint test doc build + - | + docker buildx build . \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ @@ -61,9 +74,17 @@ container-publish: docker buildx build . \ --build-arg SCM_VERSION=${CI_COMMIT_TAG} \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ - --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ --file .devcontainer/Dockerfile \ - --provenance false \ + --load \ + --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} \ + --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ + --target prod + - docker run --rm ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} + - | + docker buildx build . \ + --build-arg SCM_VERSION=${CI_COMMIT_TAG} \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ --push \ --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} \ --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja index 8d77feb5..ccb1d762 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja @@ -3,9 +3,6 @@ name: CI on: pull_request: - types: - - opened - - synchronize push: branches: - main @@ -29,10 +26,7 @@ jobs: version: 2.15.2 - run: env | sort - run: make dev - - run: make lint - - run: make test - - run: make doc - - run: make build + - run: make lint test doc build strategy: matrix: os: diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja index 74f022ff..4fbeb221 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja @@ -1,14 +1,32 @@ [% from pathjoin("includes", "version_compare.jinja") import version_between -%] name: DevContainer + +on: + pull_request: + paths: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .github/workflows/devcontainer.yml + push: + branches: + - main + paths: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .github/workflows/devcontainer.yml + workflow_dispatch: null + concurrency: cancel-in-progress: true group: {{ '${{ github.workflow }}-${{ github.ref }}' }} + jobs: dev-container-publish: permissions: packages: write runs-on: ubuntu-22.04 steps: + - run: env | sort - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - run: docker login -u {{ '${{ github.actor }}' }} -p {{ '${{ secrets.GITHUB_TOKEN }}' }} ghcr.io - run: | @@ -19,9 +37,30 @@ jobs: docker buildx build . \ --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ --cache-from type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ + --target dev + - run: | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ + make dev lint test doc build + - run: | + docker buildx build . \ + --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} \ + --target prod + - run: docker run --rm ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} + - if: github.event_name != 'pull_request' + run: | + docker buildx build . \ + --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ --cache-to type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ --target dev @@ -29,26 +68,17 @@ jobs: matrix: python-version: [%- if version_between("3.8", min_py, max_py) %] - - "3.8" + - '3.8' [%- endif %] [%- if version_between("3.9", min_py, max_py) %] - - "3.9" + - '3.9' [%- endif %] [%- if version_between("3.10", min_py, max_py) %] - - "3.10" + - '3.10' [%- endif %] [%- if version_between("3.11", min_py, max_py) %] - - "3.11" + - '3.11' [%- endif %] [%- if version_between("3.12", min_py, max_py) %] - - "3.12" + - '3.12' [%- endif %] -on: - push: - branches: - - main - paths: - - .devcontainer/Dockerfile - - .devcontainer/Dockerfile.dockerignore - - .github/workflows/devcontainer.yml - workflow_dispatch: null diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja index 004b5c8a..a27d9ef7 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja @@ -45,6 +45,7 @@ jobs: packages: write runs-on: ubuntu-22.04 steps: + - run: env | sort - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - run: docker login -u {{ '${{ github.actor }}' }} -p {{ '${{ secrets.GITHUB_TOKEN }}' }} ghcr.io - run: | @@ -55,9 +56,22 @@ jobs: docker buildx build . \ --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ --cache-from type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ + --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }}-{{ '${{ github.ref_name }}' }} \ + --target dev + - run: | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ + make dev lint test doc build + - run: | + docker buildx build . \ + --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ --cache-to type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }} \ --tag ghcr.io/{{ '${{ github.repository }}' }}/dev:py{{ '${{ matrix.python-version }}' }}-{{ '${{ github.ref_name }}' }} \ @@ -66,9 +80,17 @@ jobs: docker buildx build . \ --build-arg SCM_VERSION={{ '${{ github.ref_name }}' }} \ --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ - --cache-from type=registry,ref=ghcr.io/{{ '${{ github.repository }}' }}/dev-cache:py{{ '${{ matrix.python-version }}' }} \ --file .devcontainer/Dockerfile \ - --provenance false \ + --load \ + --tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} \ + --tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }}-{{ '${{ github.ref_name }}' }} \ + --target prod + - run: docker run --rm ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} + - run: | + docker buildx build . \ + --build-arg SCM_VERSION={{ '${{ github.ref_name }}' }} \ + --build-arg PYTHON_VERSION={{ '${{ matrix.python-version }}' }} \ + --file .devcontainer/Dockerfile \ --push \ --tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }} \ --tag ghcr.io/{{ '${{ github.repository }}' }}:py{{ '${{ matrix.python-version }}' }}-{{ '${{ github.ref_name }}' }} \ diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja index fd4e92e5..3aa29530 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja @@ -26,6 +26,11 @@ dev-container-publish: - .gitlab/workflows/devcontainer.yml if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" + - changes: + - .devcontainer/Dockerfile + - .devcontainer/Dockerfile.dockerignore + - .gitlab/workflows/devcontainer.yml + if: $CI_PIPELINE_SOURCE == 'merge_request_event' script: - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - docker context create builder @@ -35,9 +40,21 @@ dev-container-publish: docker buildx build . \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + --target dev + - | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + make dev lint test doc build + - | + docker buildx build . \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ --target dev diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja index 24465495..aebaeb52 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja @@ -61,9 +61,22 @@ container-publish: docker buildx build . \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ + --load \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ + --target dev + - | + docker run --rm \ + -e CI=true \ + -v ${PWD}:/workspace \ + ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ + make dev lint test doc build + - | + docker buildx build . \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION},mode=max \ --file .devcontainer/Dockerfile \ - --provenance false \ --push \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION} \ --tag ${CI_REGISTRY_IMAGE}/dev:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ @@ -72,9 +85,17 @@ container-publish: docker buildx build . \ --build-arg SCM_VERSION=${CI_COMMIT_TAG} \ --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ - --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}/dev-cache:py${PYTHON_VERSION} \ --file .devcontainer/Dockerfile \ - --provenance false \ + --load \ + --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} \ + --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \ + --target prod + - docker run --rm ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} + - | + docker buildx build . \ + --build-arg SCM_VERSION=${CI_COMMIT_TAG} \ + --build-arg PYTHON_VERSION=${PYTHON_VERSION} \ + --file .devcontainer/Dockerfile \ --push \ --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION} \ --tag ${CI_REGISTRY_IMAGE}:py${PYTHON_VERSION}-${CI_COMMIT_TAG} \