-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·49 lines (40 loc) · 1.01 KB
/
deploy.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
start=$(date +"%s")
ssh -p ${SERVER_PORT} ${SERVER_USER}@${SERVER_HOST} -i key.txt -t -t -o StrictHostKeyChecking=no <<'ENDSSH'
docker pull tarcisiodelmondes/minebox:latest
CONTAINER_NAME=minebox
if [ -n "$(docker ps -qa -f name=$CONTAINER_NAME)" ]; then
if [ -n "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
echo "Container is running -> stopping it..."
docker stop $CONTAINER_NAME;
fi
fi
docker run -d --rm --network=host \
-e AWS_REGION \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-e BUCKET_NAME \
-e AWS_REGION \
-e SENTRY_AUTH_TOKEN \
-e SENTRY_DSN \
-e SENTRY_ENABLED \
-e APP_PROFILE=prod \
-e POSTGRES_PASSWORD \
-e POSTGRES_USER \
-e POSTGRES_DB \
-e DATABASE_URL \
-e JWT_SECRET \
-e JWT_EXPIRATION \
-e JWT_REFRESH_EXPIRATION \
-e CORS_ORIGINS \
--name $CONTAINER_NAME tarcisiodelmondes/minebox:latest
exit
ENDSSH
if [ $? -eq 0 ]; then
exit 0
else
exit 1
fi
end=$(data +"%s")
diff=$(($end - $start))
echo "Deployed in: ${diff}s"