Skip to content

Commit ed339d0

Browse files
barckcodeclaude
andcommitted
feat: add GitHub Actions deploy workflow + SSL config
- GH Actions workflow: build 3 Docker images → push to GHCR → SSH deploy - Host nginx configured with Cloudflare Origin SSL (port 443) - HTTP→HTTPS redirect on host nginx - SSL certs excluded from git via ssl/.gitignore - Container nginx/ports unchanged (internal only) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f5f7f59 commit ed339d0

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
REPO: barckcode/tf-mobility
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Build and push frontend
30+
uses: docker/build-push-action@v6
31+
with:
32+
context: ./frontend
33+
push: true
34+
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/frontend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/frontend:${{ github.sha }}
35+
36+
- name: Build and push backend
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: ./backend
40+
push: true
41+
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/backend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/backend:${{ github.sha }}
42+
43+
- name: Build and push etl
44+
uses: docker/build-push-action@v6
45+
with:
46+
context: ./etl
47+
push: true
48+
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/etl:latest,${{ env.REGISTRY }}/${{ env.REPO }}/etl:${{ github.sha }}
49+
50+
- name: Deploy to server
51+
uses: appleboy/ssh-action@v1
52+
with:
53+
host: ${{ secrets.DEPLOY_HOST }}
54+
username: ${{ secrets.DEPLOY_USER }}
55+
key: ${{ secrets.DEPLOY_SSH_KEY }}
56+
script: |
57+
cd /home/observer/tf-mobility
58+
git pull origin main
59+
docker compose build
60+
docker compose up -d frontend backend
61+
docker image prune -f

ssl/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pem
2+
*.key
3+
*.crt

0 commit comments

Comments
 (0)