Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddy support #29

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
driver: docker
- name: Build production environment using docker-compose
run: |
docker-compose -f docker-compose.yml build production
docker compose -f docker-compose.yml -f docker-compose.caddy.yml build production

- name: Save Docker image as a tarball
run: docker save bxt_production:latest -o bxt-production.tar
Expand All @@ -26,6 +26,7 @@ jobs:
path: |
bxt-production.tar
docker-compose.yml
docker-compose.caddy.yml

deploy-ssh:
name: Deploy to server using ssh
Expand All @@ -51,11 +52,15 @@ jobs:

- name: Deploy Docker image on server
uses: appleboy/ssh-action@v1.0.3
env:
CADDY_HOST: ${{ secrets.DEPLOYMENT_SERVER_HOST }}
with:
host: ${{ secrets.DEPLOYMENT_SERVER_HOST }}
username: ${{ secrets.DEPLOYMENT_SERVER_USER }}
key: ${{ secrets.DEPLOYMENT_SERVER_SSH_KEY }}
envs: CADDY_HOST
script: |
docker compose -f /tmp/bxt/distfiles/docker-compose.yml stop || true
docker load -i /tmp/bxt/distfiles/bxt-production.tar
docker compose -f /tmp/bxt/distfiles/docker-compose.yml up -d production
cd /tmp/bxt/distfiles/
docker compose -f docker-compose.yml -f docker-compose.caddy.yml down production || true
docker load -i bxt-production.tar
docker compose -f docker-compose.yml -f docker-compose.caddy.yml -p bxt up -d production
28 changes: 28 additions & 0 deletions docker-compose.caddy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
networks:
- caddy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- caddy_data:/data
restart: unless-stopped
production:
ports: !reset []
networks:
- caddy
labels:
caddy: "${CADDY_HOST}"
caddy.reverse_proxy: "{{upstreams 8080}}"

networks:
caddy:
external: true

volumes:
caddy_data: {}