change docker-compose to compose #114
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 nordvpn proxy multi-arch images | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- main | |
paths-ignore: | |
- '.github/**' | |
env: | |
IMAGE: nordvpn-proxy | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
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 | |
with: | |
version: latest | |
install: true | |
use: true | |
- name: Builder instance name | |
run: echo ${{ steps.buildx.outputs.name }} | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to Docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
images: | | |
${{ secrets.DOCKER_USER }}/${{ env.IMAGE }} | |
flavor: | | |
latest=${{ startsWith(github.ref, 'refs/heads/master') }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/main', github.event.repository.default_branch) }} | |
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch,enable=${{ github.event_name != 'schedule' }} | |
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag | |
type=schedule,pattern=nightly | |
- name: Sets env DOCKER_PUSH to false when on main | |
run: | | |
echo "DOCKER_PUSH=false" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/heads/main') | |
- name: Sets env DOCKER_PUSH to true when on master | |
run: | | |
echo "DOCKER_PUSH=true" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/heads/master') | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
build-args: | | |
- VER="3.19" | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
push: ${{env.DOCKER_PUSH }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Inspect image | |
if: ${{ env.DOCKER_PUSH }} | |
run: | | |
docker buildx imagetools inspect ${{ secrets.DOCKER_USER }}/${{ env.IMAGE }}:master | |
- name: clean | |
if: always() && github.event_name != 'pull_request' | |
run: | | |
rm -f ${HOME}/.docker/config.json |