fix(docker): fixes tor-onionbalance-manager build and other dockerfil… #29
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 multiarch image - tag | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" | |
branches: | |
- master | |
- release/* | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci-skip]')" | |
steps: | |
- name: Get latest tag | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF:10} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.vars.outputs.tag }} | |
- name: Prepare | |
id: prep | |
run: | | |
BUILD_DATE=$(date --rfc-3339=seconds --utc) | |
echo ::set-output name=build_date::${BUILD_DATE} | |
PLATFORMS=amd64,arm,arm64 | |
TAGS1="quay.io/${{ github.repository_owner }}/tor-controller:${{ steps.vars.outputs.tag }}" | |
TAGS2="quay.io/${{ github.repository_owner }}/tor-daemon:${{ steps.vars.outputs.tag }}" | |
TAGS3="quay.io/${{ github.repository_owner }}/tor-daemon-manager:${{ steps.vars.outputs.tag }}" | |
TAGS4="quay.io/${{ github.repository_owner }}/tor-onionbalance-manager:${{ steps.vars.outputs.tag }}" | |
if [ "${{github.event_name}}" == "pull_request" ]; then | |
echo ::set-output name=push::false | |
else | |
echo ::set-output name=push::true | |
echo ::set-output name=tags1::${TAGS1} | |
echo ::set-output name=tags2::${TAGS2} | |
echo ::set-output name=tags3::${TAGS3} | |
echo ::set-output name=tags4::${TAGS4} | |
echo ::set-output name=branch::${GIT_BRANCH} | |
fi | |
echo ::set-output name=platforms::${PLATFORMS} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: ${{ steps.prep.outputs.platforms }} | |
- name: Login to Quay.io | |
uses: docker/login-action@v1 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
install: true | |
version: latest | |
driver-opts: image=moby/buildkit:latest | |
- name: Build and push (tor-controller) | |
uses: docker/build-push-action@v2 | |
with: | |
labels: | | |
org.opencontainers.image.created=${{ steps.prep.outputs.build_date }} | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: Dockerfile | |
platforms: ${{ steps.prep.outputs.platforms }} | |
push: ${{ steps.prep.outputs.push }} | |
tags: ${{ steps.prep.outputs.tags1 }} | |
- name: Build and push (tor-daemon) | |
uses: docker/build-push-action@v2 | |
with: | |
labels: | | |
org.opencontainers.image.created=${{ steps.prep.outputs.build_date }} | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: Dockerfile.tor-daemon | |
platforms: ${{ steps.prep.outputs.platforms }} | |
push: ${{ steps.prep.outputs.push }} | |
tags: ${{ steps.prep.outputs.tags2 }} | |
- name: Build and push (tor-daemon-manager) | |
uses: docker/build-push-action@v2 | |
with: | |
labels: | | |
org.opencontainers.image.created=${{ steps.prep.outputs.build_date }} | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: Dockerfile.tor-daemon-manager | |
platforms: ${{ steps.prep.outputs.platforms }} | |
push: ${{ steps.prep.outputs.push }} | |
tags: ${{ steps.prep.outputs.tags3 }} | |
- name: Build and push (tor-onionbalance-manager) | |
uses: docker/build-push-action@v2 | |
with: | |
labels: | | |
org.opencontainers.image.created=${{ steps.prep.outputs.build_date }} | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: Dockerfile.tor-onionbalance-manager | |
platforms: ${{ steps.prep.outputs.platforms }} | |
push: ${{ steps.prep.outputs.push }} | |
tags: ${{ steps.prep.outputs.tags4 }} |