diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cd9263c..f7bed9dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -232,6 +232,12 @@ jobs: if: | github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + services: + registry: + image: registry:2 + ports: + - 5000:5000 + steps: - uses: actions/checkout@v4 - name: Get current date @@ -239,15 +245,24 @@ jobs: run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx + - name: Set up Docker Buildx for local image build and push uses: docker/setup-buildx-action@v3 with: platforms: linux/amd64,linux/arm64 - - name: Login to Docker Hub - uses: docker/login-action@v3 + driver-opts: network=host + + # Do an initial build of the base image and push to a local registry for downstream + # images because the `docker-container` driver can't find local images with `load` + - name: Build and push image [oss] to local registry for downstream + uses: docker/build-push-action@v5 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + file: Dockerfile.oss + context: . + push: true + platforms: linux/amd64,linux/arm64 + provenance: false + tags: localhost:5000/nginx-oss-s3-gateway:oss + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -255,6 +270,13 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + # This second invocation of build/push should just use the existing build cache - name: Build and push image [oss] uses: docker/build-push-action@v5 with: @@ -274,6 +296,8 @@ jobs: with: file: Dockerfile.latest-njs context: . + build-contexts: | + nginx-s3-gateway=docker-image://localhost:5000/nginx-oss-s3-gateway:oss push: true platforms: linux/amd64,linux/arm64 provenance: false @@ -288,6 +312,8 @@ jobs: with: file: Dockerfile.unprivileged context: . + build-contexts: | + nginx-s3-gateway=docker-image://localhost:5000/nginx-oss-s3-gateway:oss push: true platforms: linux/amd64,linux/arm64 provenance: false