hotfix(docker-compose): fix/add credential env setting (#17) #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
MINIO_ROOT_USER = ${{ secrets.MINIO_ROOT_USER }} | |
MINIO_ROOT_PASSWORD = ${{ secrets.MINIO_ROOT_PASSWORD }} | |
EOF | |
- name: Check if Caddy containers are running | |
id: check-caddy-container | |
run: | | |
{ | |
echo 'stdout<<EOF' | |
docker compose --profile caddy ps -q | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
- name: Run Docker Compose Of Loki | |
run: | | |
docker compose --profile loki up -d --no-recreate | |
- name: Run Docker Compose Of Minio | |
run: | | |
docker compose --profile minio up -d --no-recreate | |
- name: Initialize grafana container | |
run: | | |
docker compose --profile grafana-console up -d --no-recreate | |
- name: when caddy container down, caddy up | |
if: steps.check-caddy-container.outputs.stdout == '' | |
run: | | |
docker compose --profile caddy up -d --no-recreate | |
- name: Set Caddyfile Environment Variables | |
run: | | |
sed -i 's/{$AWS_REQ_IP}/${{secrets.AWS_REQ_IP}}/' ./Caddyfile | |
- 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 |