chore: optimize dockerfile (#532) #32
This file contains 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: DevContainer | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
dev-container-publish: | |
permissions: | |
packages: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- run: | | |
docker context create builder | |
docker buildx create builder --name container --driver docker-container --use | |
docker buildx inspect --bootstrap --builder container | |
- run: | | |
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 }} \ | |
--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 |