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 and push multi-arch ubuntu-systemd Docker image | |
on: | |
push: | |
paths: | |
- 'ubuntu-systemd/Dockerfile' | |
pull_request: | |
paths: | |
- 'ubuntu-systemd/Dockerfile' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create init | |
run: | | |
sudo apt install -y g++-aarch64-linux-gnu | |
sudo aarch64-linux-gnu-g++ ubuntu-systemd/init.cpp -o ubuntu-systemd/init.aarch64 | |
sudo apt install -y g++ | |
sudo g++ ubuntu-systemd/init.cpp -o ubuntu-systemd/init.x86_64 | |
file ubuntu-systemd/init.aarch64 | |
file ubuntu-systemd/init.x86_64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ubuntu-systemd/Dockerfile | |
push: true | |
tags: kaylor/ubuntu-systemd:latest | |
platforms: linux/arm64, linux/amd64 | |
- name: Logout of DockerHub | |
run: docker logout |