flaskapp/.gitea/workflows/build.yml

45 lines
1.8 KiB
YAML
Raw Normal View History

2023-09-12 15:31:09 +10:00
name: Build Docker
run-name: Build Docker Images
on:
push:
branches:
- '*'
- '*/*'
tags-ignore:
- '*'
jobs:
Build Docker:
runs-on: [ubuntu-latest, arm] # Add amd later to require amd64
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Docker
run : |
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce-cli -y
- name: Build Docker image
run : |
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u wvac --password-stdin
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
tag=${tag//\//-}
tag_num=${GITHUB_RUN_NUMBER}
echo "tag_num=$tag_num"
if [[ "$tag" == "main" ]]; then
tag="latest"
else
tag_num="${tag}-${tag_num}"
fi
docker build -t 3d-models:$tag .
docker tag 3d-models:$tag git.woodburn.au/nathanwoodburn/3d-models:$tag
docker push git.woodburn.au/nathanwoodburn/3d-models:$tag
docker tag 3d-models:$tag git.woodburn.au/nathanwoodburn/3d-models:latest
docker push git.woodburn.au/nathanwoodburn/3d-models:latest