Skip to content

Commit a547388

Browse files
chore: ci for docker
1 parent 6d8da1a commit a547388

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout 🛎️
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Install SSH Client
1919
run: sudo apt-get update && sudo apt-get install -y openssh-client
@@ -34,11 +34,21 @@ jobs:
3434
- name: Deploy to Server 🚀
3535
run: |
3636
ssh server << 'EOF'
37+
set -euo pipefail
38+
3739
cd /var/www/cms/
38-
export NODE_OPTIONS="--max_old_space_size=2048"
39-
git pull origin main
40-
yarn install
41-
yarn build
42-
pm2 restart 1337-cms.undershows.com.br
43-
chown -R www-data:www-data /var/www/cms/
40+
git fetch --all
41+
git reset --hard origin/main
42+
43+
docker build -t undershows-cms .
44+
45+
docker stop undershows-cms || true
46+
docker rm undershows-cms || true
47+
48+
docker run -d --name undershows-cms --restart unless-stopped --env-file .env -p 127.0.0.1:1337:1337 -v $(pwd)/public/uploads:/app/public/uploads --read-only --tmpfs /tmp --tmpfs /app/.cache --tmpfs /app/.tmp --cap-drop ALL --security-opt no-new-privileges:true undershows-cms
49+
50+
sleep 2
51+
docker ps --filter "name=undershows-cms" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
52+
docker logs --tail=80 undershows-cms
53+
4454
EOF

0 commit comments

Comments
 (0)