Skip to content

add proxy support.

add proxy support. #24

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Docker Build Action
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master and develop branch
workflow_dispatch:
push:
branches:
- 'master'
- 'develop'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
- 'develop'
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE_NAME: asfbot
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Sets env vars for tag latest
run: |
echo "DOCKER_IMAGE_TAG=:latest" >> $GITHUB_ENV
if: github.ref_name == 'master' && github.event_name != 'pull_request'
- name: Sets env vars for other branches
run: |
echo "DOCKER_IMAGE_TAG=:$GITHUB_REF_NAME" >> $GITHUB_ENV
if: github.ref_name != 'master' && github.event_name != 'pull_request'
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build_GHCR
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
file: Dockerfile
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}${{ env.DOCKER_IMAGE_TAG }}
${{ secrets.DOCKER_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}${{ env.DOCKER_IMAGE_TAG }}
- name: Docker Hub Description
if: github.event_name != 'pull_request' && github.ref_name == 'master'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.DOCKER_IMAGE_NAME }}
readme-filepath: ./README.md