name: NodBot PE Dockerization ###################################################### # Creates a new Docker image of nodbot-dev, pushes # # it to DockerHub, and restarts the container. # ###################################################### # Run when a new tag for dev is pushed on: push: tags: - 'v*-dev*' # Pull DockerHub credentials from secrets env: DHUB_UNAME: ${{ secrets.DHUB_UNAME }} DHUB_PWORD: ${{ secrets.DHUB_PWORD }} jobs: build: runs-on: self-hosted steps: - name: Clean up old environment run: | rm -rf /var/lib/act_runner/nodbot rm -rf /var/lib/act_runner/nodbot-dev - name: Pull latest from Git run: | echo "Ref: ${{ gitea.ref_name }}" echo "Branch: tags/${{ gitea.ref_name }}" cd /var/lib/act_runner git clone https://git.vfsh.dev/voidf1sh/nodbot cd nodbot git checkout tags/${{ gitea.ref_name }} - name: Build the Docker image run: | cd /var/lib/act_runner/nodbot docker build --target dev . --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: | cd /var/lib/act_runner/nodbot docker push v0idf1sh/nodbot-dev - name: Restart the container run: | cd /srv/docker/nodbot-dev docker-compose down docker-compose up -d