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
|
||||
run: |
|
||||
docker build -t timelapse-calc:latest \
|
||||
-f Dockerfile .
|
||||
npm ci
|
||||
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: |
|
||||
if docker ps -a --format '{{.Names}}' | grep -q '^timelapse-calc$'; then
|
||||
docker stop timelapse-calc
|
||||
docker rm timelapse-calc
|
||||
fi
|
||||
|
||||
- name: Run new container
|
||||
run: |
|
||||
docker run -d \
|
||||
--restart always \
|
||||
--name timelapse-calc \
|
||||
-p 3005:80 \
|
||||
timelapse-calc:latest
|
||||
|
||||
docker ps --format "{{.Names}} {{.Image}} {{.Status}}"
|
||||
rm -rf /deploy/vite-app/timelapse-calc
|
||||
mkdir -p /deploy/vite-app/timelapse-calc
|
||||
cp -r dist/* /deploy/vite-app/timelapse-calc/
|
||||
echo "Deployment completed successfully"
|
||||
echo "Deployed files:"
|
||||
ls -la /deploy/vite-app/timelapse-calc/
|
||||
Reference in New Issue
Block a user