Fixed Prod Deployment
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 1m5s

This commit is contained in:
Skylar Grant 2024-09-23 18:51:43 -04:00
parent 70fc12d458
commit 9d9a1447f3

View File

@ -3,33 +3,43 @@ name: NodBot Production Dockerization
on: on:
pull_request: pull_request:
branches: branches:
- main - main
env: env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }} DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
DHUB_PWORD: ${{ secrets.DHUB_PWORD }} DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
jobs: jobs:
build: build:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- name: Pull latest from Git - name: Pull latest from Git
run: | run: |
echo "Branch: ${{ gitea.head_ref }}"
pwd pwd
whoami whoami
cd /root/nodbot mkdir -p /var/lib/act_runner/
git pull cd /var/lib/act_runner/
git checkout $GITHUB_HEAD_REF if [ ! -d "nodbot" ]; then
git clone https://git.vfsh.dev/voidf1sh/nodbot
cd nodbot
else
cd nodbot
git pull
fi
git checkout ${{ gitea.head_ref }}
- name: Build the Docker image - name: Build the Docker image
run: | run: |
cd /root/nodbot cd /var/lib/act_runner/nodbot
docker build . --file Dockerfile --tag v0idf1sh/nodbot docker build . --file Dockerfile --tag v0idf1sh/nodbot
- name: Log into Docker Hub - name: Log into Docker Hub
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
- name: Push image to Docker Hub - name: Push image to Docker Hub
run: | run: |
cd /root/nodbot cd /var/lib/act_runner/nodbot
docker push v0idf1sh/nodbot docker push v0idf1sh/nodbot
- name: Restart the container
run: |
cd /srv/docker/nodbot
docker-compose down
docker-compose up -d