Update 40-install #50
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
name: Build Container | |
on: | |
push: | |
paths: | |
- "Dockerfile" | |
- "root/**" | |
- ".github/workflows/build.yml" | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
architecture: [linux-arm-v7, linux-arm64, linux-amd64] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create VARS | |
id: vars | |
run: | | |
ARCHITECTURE=${{ matrix.architecture }} | |
TIME=$(date --utc +%Y-%m-%d_%H) | |
echo "platform=${ARCHITECTURE//-/\/}" >> $GITHUB_OUTPUT | |
echo "repo=$(echo ${GITHUB_REPOSITORY//docker-/} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
echo "time=$TIME" >> $GITHUB_OUTPUT | |
echo "source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${GITHUB_REF//refs\/heads\//}" >> $GITHUB_OUTPUT | |
echo "url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/master/README.md" >> $GITHUB_OUTPUT | |
echo "tag=$(echo ${GITHUB_REPOSITORY//docker-/} | tr '[:upper:]' '[:lower:]'):${{ matrix.architecture }}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
version: latest | |
driver-opts: image=moby/buildkit:master | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: roxedus | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: roxedus | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: ${{ steps.vars.outputs.platform }} | |
file: ./Dockerfile | |
build-args: | | |
ARCH=${{ matrix.architecture }} | |
tags: | | |
${{ steps.vars.outputs.tag }} | |
ghcr.io/${{ steps.vars.outputs.tag }} | |
labels: | | |
org.opencontainers.image.created=${{ steps.vars.outputs.time }} | |
org.opencontainers.image.source=${{ steps.vars.outputs.source }} | |
org.opencontainers.image.url=${{ steps.vars.outputs.url }} | |
publish: | |
runs-on: ubuntu-22.04 | |
needs: [build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: roxedus | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: roxedus | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifests for DockerHub | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
run: | | |
IMAGE=$(echo ${GITHUB_REPOSITORY//docker-/} | tr '[:upper:]' '[:lower:]') | |
SOURCE=${IMAGE} | |
docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}:linux-amd64 ${SOURCE}:linux-arm-v7 ${SOURCE}:linux-arm64 | |
- name: Create manifests for GitHub Container Registry | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
run: | | |
IMAGE=ghcr.io/$(echo ${GITHUB_REPOSITORY//docker-/} | tr '[:upper:]' '[:lower:]') | |
SOURCE=${IMAGE} | |
docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}:linux-amd64 ${SOURCE}:linux-arm-v7 ${SOURCE}:linux-arm64 |