shakecities/.gitea/workflows/build.yml

79 lines
3.5 KiB
YAML
Raw Permalink Normal View History

2023-11-08 17:55:49 +11:00
name: Build Docker
run-name: Build Docker Images
on:
push:
jobs:
2023-11-08 18:19:31 +11:00
Build Main Image:
2023-11-08 17:55:49 +11:00
runs-on: [ubuntu-latest, amd]
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 nathanwoodburn --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 shakecities:$tag_num .
docker tag shakecities:$tag_num git.woodburn.au/nathanwoodburn/shakecities:$tag_num
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag_num
docker tag shakecities:$tag_num git.woodburn.au/nathanwoodburn/shakecities:$tag
2023-11-08 18:19:31 +11:00
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag
Build SLDs Image:
runs-on: [ubuntu-latest, amd]
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 : |
cd sites
cp -r ../templates/ .
2023-11-08 18:23:37 +11:00
cp ../requirements.txt .
2023-11-08 18:19:31 +11:00
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --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 shakecities-sites:$tag_num .
docker tag shakecities-sites:$tag_num git.woodburn.au/nathanwoodburn/shakecities-sites:$tag_num
docker push git.woodburn.au/nathanwoodburn/shakecities-sites:$tag_num
docker tag shakecities-sites:$tag_num git.woodburn.au/nathanwoodburn/shakecities-sites:$tag
docker push git.woodburn.au/nathanwoodburn/shakecities-sites:$tag