diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index 1e41571..5bfed8d 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -15,15 +15,15 @@ jobs: - id: set-matrix run: echo "::set-output name=matrix::$(./.github/workflows/generate-image-build-matrix images/*)" - build-and-push-arena-images: + build-base-image: + name: Build Arena Base Image needs: [generate-matrix] runs-on: ubuntu-latest if: ${{ needs.generate-matrix.outputs.matrix != '[]' }} strategy: fail-fast: true matrix: - include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} - + python_version: ${{ fromJson(needs.generate-matrix.outputs.matrix).base }} steps: - name: Checkout uses: actions/checkout@v2 @@ -34,6 +34,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -48,26 +49,75 @@ jobs: username: diambra+github password: ${{ secrets.QUAY_TOKEN }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ghcr.io/diambra/arena-${{ matrix.name }} - docker.io/diambra/arena-${{ matrix.name }} - quay.io/diambra/arena-${{ matrix.name }} - tags: | - type=ref,event=branch - type=semver,pattern=v{{version}} - type=semver,pattern=v{{major}}.{{minor}} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push arena ${{ matrix.dir }} + - name: Build and push base image uses: docker/build-push-action@v3 with: context: . - file: ${{ matrix.dir }}/Dockerfile + file: images/base/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ matrix.build_args }} \ No newline at end of file + tags: ghcr.io/diambra/arena-base:${{ github.sha }},docker.io/diambra/arena-base:${{ github.sha }},quay.io/diambra/arena-base:${{ github.sha }} + build-args: PYTHON_VERSION=${{ matrix.python_version }} + - name: Save base image + uses: actions/upload-artifact@v2 + with: + name: base-image + path: ${{ runner.workspace }}/images/base + + #build-and-push-arena-libs-images: + # name: Build Arena Libs Image + # needs: [generate-matrix] + # runs-on: ubuntu-latest + # if: ${{ needs.generate-matrix.outputs.matrix != '[]' }} + # strategy: + # fail-fast: true + # matrix: + # include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} + # + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # + # - name: Login to GHCR + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} + # + # - name: Login to Docker Hub + # uses: docker/login-action@v2 + # with: + # registry: docker.io + # username: diambrabot + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # + # - name: Login to Quay + # uses: docker/login-action@v2 + # with: + # registry: quay.io + # username: diambra+github + # password: ${{ secrets.QUAY_TOKEN }} + # + # - name: Docker meta + # id: meta + # uses: docker/metadata-action@v4 + # with: + # images: | + # ghcr.io/diambra/arena-${{ matrix.name }} + # docker.io/diambra/arena-${{ matrix.name }} + # quay.io/diambra/arena-${{ matrix.name }} + # tags: | + # type=ref,event=branch + # type=semver,pattern=v{{version}} + # type=semver,pattern=v{{major}}.{{minor}} + # type=raw,value=latest,enable={{is_default_branch}} + # + # - name: Build and push arena ${{ matrix.dir }} + # uses: docker/build-push-action@v3 + # with: + # context: . + # file: ${{ matrix.dir }}/Dockerfile + # push: true + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + # build-args: ${{ matrix.build_args }} \ No newline at end of file