This commit is contained in:
@@ -13,35 +13,22 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
docker build -t timelapse-calc:latest \
|
||||||
npm run build
|
-f Dockerfile .
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Stop old container if exists
|
||||||
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: |
|
||||||
rm -rf /deploy/vite-app/timelapse-calc
|
if docker ps -a --format '{{.Names}}' | grep -q '^timelapse-calc$'; then
|
||||||
mkdir -p /deploy/vite-app/timelapse-calc
|
docker stop timelapse-calc
|
||||||
cp -r dist/* /deploy/vite-app/timelapse-calc/
|
docker rm timelapse-calc
|
||||||
echo "Deployment completed successfully"
|
fi
|
||||||
echo "Deployed files:"
|
|
||||||
ls -la /deploy/vite-app/timelapse-calc/
|
- 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}}"
|
||||||
Reference in New Issue
Block a user