mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
Add workflow to build container
This commit is contained in:
parent
35071b55fc
commit
11ed078257
1 changed files with 58 additions and 0 deletions
58
.github/workflows/container.yml
vendored
Normal file
58
.github/workflows/container.yml
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
name: Build container
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
# Allow for manually running
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
container_tag:
|
||||
description: Tag for container
|
||||
default: "latest"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
container:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CONTAINER_NAME: ghcr.io/${{ github.repository }}
|
||||
BUILD_PLATFORMS: linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x
|
||||
RAW_CONTAINER_TAG: ${{ github.event.inputs.container_tag || github.event.pull_request.head.ref || 'latest' }}
|
||||
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2.0.0
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Needed for buildx gha cache to work
|
||||
- name: Expose GitHub Runtime
|
||||
uses: crazy-max/ghaction-github-runtime@v2
|
||||
|
||||
- name: Build container
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
CONTAINER_TAG=$(echo "$RAW_CONTAINER_TAG" | sed 's/[^a-zA-Z0-9]\+/-/')
|
||||
|
||||
docker buildx build \
|
||||
--platform "$BUILD_PLATFORMS" \
|
||||
--tag "$CONTAINER_NAME:$CONTAINER_TAG" \
|
||||
--cache-from type=gha \
|
||||
--cache-to type=gha,mode=max \
|
||||
--pull --push .
|
Loading…
Add table
Add a link
Reference in a new issue