Skip to content

Commit

Permalink
add platforms to all build config
Browse files Browse the repository at this point in the history
  • Loading branch information
4141done committed Jan 10, 2024
1 parent e086211 commit 1e32e13
Showing 1 changed file with 53 additions and 4 deletions.
57 changes: 53 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ jobs:
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host
platforms: linux/amd64,linux/arm64
- name: Build and export oss image
uses: docker/build-push-action@v5
with:
file: Dockerfile.oss
context: .
tags: localhost:5000/nginx-s3-gateway , localhost:5000/nginx-s3-gateway:oss
push: true
platforms: linux/amd64,linux/arm64
# Since the above build pushes to the registry only now we load it locally so we can save it
# It's not possible with push and save in one go.
- name: Load image oss
Expand All @@ -81,6 +83,7 @@ jobs:
tags: localhost:5000/nginx-s3-gateway:latest-njs-oss
push: false
outputs: type=docker,dest=/tmp/latest-njs.tar
platforms: linux/amd64,linux/arm64
build-contexts: |
nginx-s3-gateway=docker-image://localhost:5000/nginx-s3-gateway:oss
- name: Upload artifact - latest-njs
Expand All @@ -97,6 +100,7 @@ jobs:
tags: localhost:5000/nginx-s3-gateway:unprivileged
push: false
outputs: type=docker,dest=/tmp/unprivileged.tar
platforms: linux/amd64,linux/arm64
build-contexts: |
nginx-s3-gateway=docker-image://localhost:5000/nginx-s3-gateway:oss
- name: Upload artifact - unprivileged
Expand Down Expand Up @@ -213,11 +217,56 @@ jobs:
- name: Run tests - stable njs version - unprivileged process
run: ./test.sh --unprivileged --type oss

# build_and_deploy:
# runs-on: ubuntu-latest
tag-and-push:
runs-on: ubuntu-latest
needs: [test-oss, test-latest-njs, test-unprivileged]

if: |
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/main'
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Configure Github Package Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin

- name: Download artifact - oss
uses: actions/download-artifact@v3
with:
name: oss
path: /tmp
- name: Download artifact - latest-njs
uses: actions/download-artifact@v3
with:
name: latest-njs
path: /tmp
- name: Download artifact - unprivileged
uses: actions/download-artifact@v3
with:
name: unprivileged
path: /tmp

- name: Load and retag oss image [oss]
run: |
docker load --input /tmp/oss.tar
docker tag localhost:5000/nginx-s3-gateway docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-${{ steps.date.outputs.date }}-new-build-test
docker tag localhost:5000/nginx-s3-gateway docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-new-build-test
- name: Push container image to github [oss date]
run: docker push docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-${{ steps.date.outputs.date }}-new-build-test
- name: Push container image to github [oss latest]
run: docker push docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-new-build-test
- name: Load and retag oss image [latest-njs-oss]
run: |
docker load --input /tmp/latest-njs.tar
docker tag localhost:5000/nginx-s3-gateway::latest-njs-oss docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-njs-oss-${{ steps.date.outputs.date }}-new-build-test
docker tag localhost:5000/nginx-s3-gateway::latest-njs-oss docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-njs-oss-new-build-test
- name: Push container image to github [latest-njs-oss date]
run: docker push docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-njs-oss-${{ steps.date.outputs.date }}-new-build-test
- name: Push container image to github [latest-njs-oss]
run: docker push docker.pkg.github.com/$GITHUB_REPOSITORY/nginx-oss-s3-gateway:latest-njs-oss-new-build-test


# if: github.ref == 'refs/heads/master'
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v2

Expand Down

0 comments on commit 1e32e13

Please sign in to comment.