Add automatic build of Docker image to packages #1
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 | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
pull_request: | |
jobs: | |
build-images: | |
name: Build Docker images | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: build amnezia-wg-docker image without pushing (only outside master) | |
if: ${{ github.ref != 'refs/heads/master' }} | |
run: | | |
docker buildx build \ | |
--platform linux/arm/v7 . | |
- name: build amnezia-wg-docker image for ghcr.io | |
if: ${{ github.ref == 'refs/heads/master' }} | |
env: | |
GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
USERNAME: ${{ github.actor }} | |
run: | | |
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin | |
docker buildx build --push \ | |
--platform linux/arm/v7 \ | |
-t ghcr.io/yury-sannikov/amnezia-wg-docker:latest . |