Merge branch 'main' of https://git.hcmc.online/tienngo/timelapse-calc
This commit is contained in:
@@ -13,22 +13,35 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build -t timelapse-calc:latest \
|
npm ci
|
||||||
-f Dockerfile .
|
npm run build
|
||||||
|
|
||||||
- name: Stop old container if exists
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: build-output
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
container:
|
||||||
|
image: node:20-slim
|
||||||
|
options: -v /var/www/vite-app:/deploy/vite-app --user 1000:1000
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Download build artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: build-output
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
- name: Deploy to host
|
||||||
run: |
|
run: |
|
||||||
if docker ps -a --format '{{.Names}}' | grep -q '^timelapse-calc$'; then
|
rm -rf /deploy/vite-app/timelapse-calc
|
||||||
docker stop timelapse-calc
|
mkdir -p /deploy/vite-app/timelapse-calc
|
||||||
docker rm timelapse-calc
|
cp -r dist/* /deploy/vite-app/timelapse-calc/
|
||||||
fi
|
echo "Deployment completed successfully"
|
||||||
|
echo "Deployed files:"
|
||||||
- name: Run new container
|
ls -la /deploy/vite-app/timelapse-calc/
|
||||||
run: |
|
|
||||||
docker run -d \
|
|
||||||
--restart always \
|
|
||||||
--name timelapse-calc \
|
|
||||||
-p 3005:80 \
|
|
||||||
timelapse-calc:latest
|
|
||||||
|
|
||||||
docker ps --format "{{.Names}} {{.Image}} {{.Status}}"
|
|
||||||
Reference in New Issue
Block a user