29 lines
1.2 KiB
YAML
29 lines
1.2 KiB
YAML
name: Build Docker Image
|
|
on: [push, pull_request]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install Buildx and QEMU
|
|
run: |
|
|
export DOCKER_BUILDKIT=1
|
|
docker build --platform=local -o . git://github.com/docker/buildx
|
|
mkdir -p ~/.docker/cli-plugins
|
|
mv buildx ~/.docker/cli-plugins/docker-buildx
|
|
docker run --rm --privileged multiarch/qemu-user-static:latest --reset -p yes --credential yes
|
|
docker buildx create --use --name build --node build --driver-opt network=host
|
|
- name: Build Docker image
|
|
env:
|
|
DOCKER_USERNAME: ${{ github.actor }}
|
|
DOCKER_IMAGE_PLATFORM: linux/amd64,linux/arm/v7,linux/arm64
|
|
REPOSITORY_NAME: ${{ github.repository }}
|
|
run: |
|
|
IFS='/' read -ra repository_name_array <<<"$REPOSITORY_NAME"
|
|
DOCKER_IMAGE_NAME=$(echo $DOCKER_USERNAME/${repository_name_array[1]} | tr '[:upper:]' '[:lower:]')
|
|
docker buildx build \
|
|
--platform "$DOCKER_IMAGE_PLATFORM" \
|
|
--output "type=image,push=false" \
|
|
--tag "$DOCKER_IMAGE_NAME":latest \
|
|
--file ./Dockerfile .
|