mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-19 11:42:43 +00:00
add github actions workflow to build docker images
This commit is contained in:
parent
0bdf77b473
commit
65e2371e67
77
.github/workflows/docker-images.yml
vendored
Normal file
77
.github/workflows/docker-images.yml
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
name: docker-images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- docker-test
|
||||
|
||||
jobs:
|
||||
multi:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image:
|
||||
- bandersnatch
|
||||
- ftpsync
|
||||
- homebrew-mirror
|
||||
- nix-channels
|
||||
- pub-mirror
|
||||
- rustup-mirror
|
||||
include:
|
||||
- image: tunasync-scripts
|
||||
dockerfile: .
|
||||
- image: julia-mirror
|
||||
dockerfile: dockerfiles/julia
|
||||
- image: rubygems-mirror
|
||||
dockerfile: dockerfiles/rubygems
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Determin docker tag
|
||||
env:
|
||||
TAG_NAME: ${{ github.ref }}
|
||||
run: |
|
||||
if [ "${TAG_NAME##*/}" = "master" ]; then
|
||||
tag=latest
|
||||
else
|
||||
tag=build-test
|
||||
fi
|
||||
echo "::set-env name=docker_tag::${tag}"
|
||||
-
|
||||
name: Determin dockerfile
|
||||
env:
|
||||
DF: ${{ matrix.dockerfile }}
|
||||
IMG: ${{ matrix.image }}
|
||||
run: |
|
||||
if [ -z "${DF}" ]; then
|
||||
DF="dockerfiles/${IMG}"
|
||||
fi
|
||||
echo "::set-env name=docker_file::${DF}"
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: arm64
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ${{ env.docker_file }}/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: tunathu/${{ matrix.image }}:${{ env.docker_tag }}
|
Loading…
x
Reference in New Issue
Block a user