-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.dev.sh
More file actions
38 lines (31 loc) · 1.24 KB
/
deploy.dev.sh
File metadata and controls
38 lines (31 loc) · 1.24 KB
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
#!/bin/bash
# shellcheck disable=SC2164
cd /home/ubuntu/gdgoc-be-app-dev
# Docker & Docker Compose가 설치되어 있는지 확인
if ! [ -x "$(command -v docker)" ]; then
echo "Docker가 설치되어 있지 않습니다. 설치 중..."
sudo apt update
sudo apt install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
echo "Docker 설치 완료"
fi
if ! [ -x "$(command -v docker-compose)" ]; then
echo "Docker Compose가 설치되어 있지 않습니다. 설치 중..."
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo "Docker Compose 설치 완료"
fi
# 기존 컨테이너 중지 및 삭제
docker-compose -f docker-compose-dev.yml down
# 사용되지 않는 컨테이너, 이미지, 네트워크, 볼륨 정리
docker system prune -af
# 불필요한 Docker 볼륨도 정리 (옵션)
docker volume prune -f
# 최신 이미지 가져오기
# shellcheck disable=SC2046
export $(grep -v '^#' .env | xargs)
# shellcheck disable=SC2086
docker pull ${DOCKER_HUB_USERNAME}/gdgoc-be-app-dev:latest
# 컨테이너 실행
docker-compose -f docker-compose-dev.yml --env-file .env up -d