Skip to content

fix(infra): add caddy container and update github actions (#10) #10

fix(infra): add caddy container and update github actions (#10)

fix(infra): add caddy container and update github actions (#10) #10

Workflow file for this run

name: Local Deployment
on:
push:
branches: main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Load dotenv from secret for Grafana Configuration
run: |
cat <<EOF > .env
# Sensitive configurations from GitHub Secrets
GF_SMTP_HOST = ${{ secrets.SMTP_HOST }}
GF_SMTP_USER = ${{ secrets.SMTP_USER }}
GF_SMTP_PASSWORD = ${{ secrets.SMTP_PASSWORD }}
GF_SMTP_FROM_ADDRESS = ${{ secrets.FROM_ADDRESS }}
EOF
- name: Check if containers are running
id: check-container
run: |
{
echo 'stdout<<EOF'
docker compose --profile log ps -q
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Initialize containers
if: steps.check-container.outputs.stdout == ''
run: |
docker compose --profile caddy up -d --no-recreate
docker compose --profile log up -d --no-recreate
- name: Run Docker Compose
run: |
docker compose --profile log up -d
- name: Copy Caddyfile into Caddy Container
run: |
docker cp ./Caddyfile caddy:/etc/caddy/Caddyfile
- name: Gracefully reload Caddy
run: |
docker exec -w /etc/caddy caddy caddy reload
- name: Remove unused docker storages
run: docker system prune -a -f --volumes