All checks were successful
Build and Deploy Docker Container / build-and-deploy (push) Successful in 45s
44 lines
1.5 KiB
YAML
44 lines
1.5 KiB
YAML
name: Build and Deploy Docker Container
|
|
run-name: ${{ gitea.actor }} runs docker deployment
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.allucanget.biz
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: git.allucanget.biz/${{ secrets.REGISTRY_USERNAME }}/thc-webhook:latest
|
|
|
|
- name: Verify the Docker image is running
|
|
run: |
|
|
docker run -d --name test-thc-webhook -e DISCORD_WEBHOOK_URL=${{ secrets.DISCORD_WEBHOOK_URL }} -e TENOR_API_KEY=${{ secrets.TENOR_API_KEY }} -p 8080:8080 git.allucanget.biz/${{ secrets.REGISTRY_USERNAME }}/thc-webhook:latest
|
|
sleep 10
|
|
if [ $(docker ps -q -f name=test-thc-webhook | wc -l) -eq 1 ]; then
|
|
echo "Container is running successfully."
|
|
docker logs test-thc-webhook
|
|
docker stop test-thc-webhook
|
|
docker rm test-thc-webhook
|
|
else
|
|
echo "Container failed to start."
|
|
exit 1
|
|
fi
|
|
- name: Clean up Docker images
|
|
run: docker image prune -f
|