Docker #14
This file contains hidden or 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: Docker | |
| on: | |
| push: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'dnscrypt-proxy version to build' | |
| required: true | |
| default: '' | |
| env: | |
| # Use docker.io for Docker Hub if empty | |
| REGISTRY: docker.io | |
| # Docker image name | |
| IMAGE_NAME: melchor9000/dnscrypt-proxy | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| DNSCRYPT_PROXY_VERSION: ${{ github.event.inputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup default version | |
| run: echo "DNSCRYPT_PROXY_VERSION=2.1.5" >> $GITHUB_ENV | |
| if: ${{ env.DNSCRYPT_PROXY_VERSION == '' }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Login against a Docker registry except on PR | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.DOCKER_HUB_USER }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| # Build and push Docker image with Buildx (don't push on PR) | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| build-args: VERSION=${{ env.DNSCRYPT_PROXY_VERSION }} | |
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DNSCRYPT_PROXY_VERSION }} | |
| push: true |