base #4
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: base | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
concurrency: | |
group: >- | |
${{ | |
github.workflow | |
}}-${{ | |
github.event.pull_request.number || github.sha | |
}} | |
cancel-in-progress: true | |
jobs: | |
pre-setup: | |
name: ⚙️ Pre-set global build settings | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
container-platforms: ${{ steps.container.outputs.platforms }} | |
steps: | |
- name: Calculate container attributes | |
id: container | |
shell: bash | |
run: >- | |
PLATFORMS="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x"; | |
echo "::set-output name=platforms::$PLATFORMS" | |
ghcr-base: | |
runs-on: ubuntu-20.04 | |
permissions: | |
packages: write | |
if: success() | |
needs: | |
- pre-setup # transitive, for accessing settings | |
name: 🐳 ghcr:base | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.release-commitish }} | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
# See https://github.com/docker/buildx/issues/850#issuecomment-996408167 | |
with: | |
version: v0.7.0 | |
buildkitd-flags: --debug | |
config: .github/buildkitd.toml | |
install: true | |
- name: Enable Multiarch # This slows down arm build by 4-5x | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Create builder | |
run: | | |
docker buildx create --name proxypybuilder | |
docker buildx use proxypybuilder | |
docker buildx inspect | |
docker buildx ls | |
- name: Push base to GHCR | |
run: >- | |
docker buildx build | |
--push | |
--platform ${{ | |
needs.pre-setup.outputs.container-platforms | |
}} | |
-t ghcr.io/abhinavsingh/proxy.py:base | |
-f DockerfileBase . | |
... |