nodbot/.gitea/workflows/production-docker.yml

46 lines
1.2 KiB
YAML
Raw Normal View History

2023-08-05 00:06:09 +00:00
name: NodBot Production Dockerization
on:
2024-09-29 16:40:54 +00:00
push:
tags:
- 'v*'
2023-08-05 00:06:09 +00:00
env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
jobs:
build:
runs-on: self-hosted
steps:
- name: Pull latest from Git
run: |
2024-09-29 16:40:54 +00:00
echo "Branch: ${{ gitea.ref_name }}"
2023-08-05 00:06:09 +00:00
pwd
whoami
2024-09-23 22:51:43 +00:00
mkdir -p /var/lib/act_runner/
cd /var/lib/act_runner/
if [ ! -d "nodbot" ]; then
git clone https://git.vfsh.dev/voidf1sh/nodbot
cd nodbot
else
cd nodbot
git pull
fi
2024-09-29 16:40:54 +00:00
git checkout ${{ gitea.ref_name }}
git pull
2023-08-05 00:06:09 +00:00
- name: Build the Docker image
run: |
2024-09-23 22:51:43 +00:00
cd /var/lib/act_runner/nodbot
2023-08-05 00:06:09 +00:00
docker build . --file Dockerfile --tag v0idf1sh/nodbot
- name: Log into Docker Hub
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
- name: Push image to Docker Hub
run: |
2024-09-23 22:51:43 +00:00
cd /var/lib/act_runner/nodbot
docker push v0idf1sh/nodbot
- name: Restart the container
run: |
cd /srv/docker/nodbot
docker-compose down
docker-compose up -d