CI: Extract docker platforms to env variable

This commit is contained in:
Archi
2021-05-20 23:47:22 +02:00
parent feb73a94aa
commit 0159a918cd
4 changed files with 14 additions and 8 deletions

View File

@@ -2,6 +2,9 @@ name: ASF-docker-ci
on: [push, pull_request]
env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
jobs:
main:
runs-on: ubuntu-latest
@@ -19,11 +22,11 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm,linux/arm64
platforms: ${{ env.PLATFORMS }}
- name: Build Docker image from Dockerfile.Service
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.Service
platforms: linux/amd64,linux/arm,linux/arm64
platforms: ${{ env.PLATFORMS }}

View File

@@ -5,6 +5,7 @@ on:
types: [released]
env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: latest
jobs:
@@ -43,12 +44,12 @@ jobs:
echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
- name: Build and push Docker image
- name: Build and publish Docker image from Dockerfile.Service
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.Service
platforms: linux/amd64,linux/arm,linux/arm64
platforms: ${{ env.PLATFORMS }}
build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}

View File

@@ -6,6 +6,7 @@ on:
- main
env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: main
jobs:
@@ -43,11 +44,11 @@ jobs:
echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
- name: Build and push Docker image
- name: Build and publish Docker image from Dockerfile
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm,linux/arm64
platforms: ${{ env.PLATFORMS }}
build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}

View File

@@ -6,6 +6,7 @@ on:
- '*'
env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: released
jobs:
@@ -44,11 +45,11 @@ jobs:
echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
- name: Build and push Docker image
- name: Build and publish Docker image from Dockerfile
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm,linux/arm64
platforms: ${{ env.PLATFORMS }}
build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}