forked from Developer-Club-WMU/webdev-landing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·36 lines (27 loc) · 872 Bytes
/
deploy.sh
File metadata and controls
executable file
·36 lines (27 loc) · 872 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
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Change CWD to repo home
cd /home/webdev/webdev-landing
# Check if docker is available
if ! command -v docker >/dev/null 2>&1; then
echo "Docker is not installed"
exit 1
fi
# Check if docker compose is available (v2 or v1)
if ! docker compose version >/dev/null 2>&1 && ! command -v docker-compose >/dev/null 2>&1; then
echo "Docker Compose is not installed"
exit 1
fi
# Pull Latest Code from the appropriate branch of repo PROD or DEV (PROD set to default)
ENV="${DEPLOY_ENV:-production}"
echo "Using environment: $ENV"
git fetch origin
git checkout $ENV
git pull origin $ENV
# Stop running services
docker compose down
# Pull latest image
docker pull devclubwmu/devclub-prod:webdev-landing
# Prune Old Images that arent tagged and keep only the tagged images
docker image prune -a
# Start with latest image in background
docker compose up -d