forked from XanderLuciano/nuxt-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·25 lines (18 loc) · 746 Bytes
/
deploy.sh
File metadata and controls
executable file
·25 lines (18 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
set -e
# Configure these for your environment
SERVER="user@your-server.local"
REMOTE_DIR="~/my-app"
IMAGE_NAME="my-app"
echo "==> Building Nuxt app..."
npm run build
echo "==> Building container image (linux/amd64)..."
docker build --platform linux/amd64 -t $IMAGE_NAME .
echo "==> Exporting and compressing image..."
docker save $IMAGE_NAME -o ${IMAGE_NAME}.tar
gzip -f ${IMAGE_NAME}.tar
echo "==> Transferring to server..."
rsync -avz --progress ${IMAGE_NAME}.tar.gz docker-compose.yml ${SERVER}:${REMOTE_DIR}/
echo "==> Deploying on server..."
ssh ${SERVER} "cd ${REMOTE_DIR} && gunzip -f ${IMAGE_NAME}.tar.gz && docker load -i ${IMAGE_NAME}.tar && docker-compose down && docker-compose up -d"
echo "==> Done! App is live."