Fix incompatibility in the test env #4
This file contains hidden or 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: Create and publish a Docker image | |
| on: | |
| push: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| BRANCH: ${{ github.ref }} | |
| jobs: | |
| build-and-push-image: | |
| runs-on: | |
| - ubuntu-latest | |
| # - macos-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Reset Docker & Buildx | |
| run: | | |
| docker buildx rm || true | |
| docker system prune -af | |
| docker builder prune -af | |
| - name: Free space | |
| run: | | |
| rm -rf /opt/hostedtoolcache | |
| echo "==============================================================================" | |
| echo "Freeing up disk space on CI system" | |
| echo "==============================================================================" | |
| echo "Listing 100 largest packages" | |
| dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100 | |
| df -h | |
| echo "Removing large packages" | |
| sudo apt-get remove -y '^dotnet-.*' | |
| sudo apt-get remove -y '^llvm-.*' | |
| sudo apt-get remove -y 'php.*' | |
| sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel | |
| sudo apt-get autoremove -y | |
| sudo apt-get clean | |
| df -h | |
| echo "Removing large directories" | |
| # deleting 15GB | |
| rm -rf /usr/share/dotnet/ | |
| df -h | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Free disk space | |
| run: | | |
| docker system prune -af | |
| docker builder prune -af | |
| - name: Debug build context | |
| run: du -sh . | |
| - name: Disk usage | |
| run: df -h | |
| - name: Build and export to Docker | |
| uses: docker/build-push-action@v6 | |
| with: | |
| load: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Test | |
| run: docker run --rm ${{ steps.meta.outputs.tags }} python -c "import jax; print(jax.__version__)" | |
| - name: Push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |