Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix and issue where final build cannot find the base image for build #200

Merged
merged 8 commits into from
Jan 13, 2024
36 changes: 31 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,29 +232,51 @@ 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
id: date
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:
registry: ghcr.io
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:
Expand All @@ -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
Expand All @@ -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
Expand Down