forked from Gelbpunkt/gateway-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,36 @@ | ||
name: Build Docker Images | ||
on: [push] | ||
name: Build Image | ||
|
||
jobs: | ||
build-docker-image: | ||
strategy: | ||
matrix: | ||
target-cpu: ["znver3", "znver2", "skylake", "haswell", "sandybridge", "x86-64"] | ||
permissions: | ||
packages: write | ||
|
||
name: Build for ${{ matrix.target-cpu }} | ||
env: | ||
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKER_TARGET_ACCOUNT: ${{ secrets.DOCKERHUB_TARGET }} | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
if: env.DOCKER_USERNAME | ||
- id: metadata | ||
uses: docker/metadata-action@v4 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
images: ghcr.io/poketwo/gateway-proxy | ||
|
||
- name: Login to ghcr | ||
uses: docker/login-action@v2 | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Convert GITHUB_REPOSITORY into lowercase | ||
run: | | ||
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
password: ${{ secrets.GHCR_PAT }} | ||
|
||
- name: Build Docker Image | ||
run: | | ||
docker build -t gateway-proxy:${{ matrix.target-cpu }} --build-arg TARGET_CPU=${{ matrix.target-cpu }} . | ||
- name: Create manifest and push it | ||
if: env.DOCKER_USERNAME && github.ref == 'refs/heads/main' | ||
run: | | ||
docker tag gateway-proxy:${{ matrix.target-cpu }} ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }} | ||
docker push ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }} | ||
- uses: docker/build-push-action@v4 | ||
with: | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
push: true | ||
secrets: | | ||
GIT_AUTH_TOKEN=${{ secrets.GHCR_PAT }} | ||
docker tag gateway-proxy:${{ matrix.target-cpu }} ghcr.io/${REPO}:${{ matrix.target-cpu }} | ||
docker push ghcr.io/${REPO}:${{ matrix.target-cpu }} |