Skip to content

feat(Docker): build image for ghcr #16

feat(Docker): build image for ghcr

feat(Docker): build image for ghcr #16

Workflow file for this run

name: Build proxy docker image
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }}
cancel-in-progress: true
jobs:
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
# Create a build container which buildx will u
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CI_PAT }}
- name: Setup Docker layer Cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ github.event.number }}
restore-keys: ${{ runner.os }}-docker-
# Automagically extract useful information from the current github context and creates
# a set of labels for use by build-push-action to be attached to the final image.
- name: Extract Metadata for Docker
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
id: meta
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile.proxy
tags: ghcr.io/${{ github.repository }}:PR${{ github.event.number }}
# We use local cache type, so we can clean up the cache
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#local-cache
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
labels: ${{ steps.meta.outputs.labels }}
push: true