오늘은 도커를 활용하여 테스트용 서버 환경을 구성해 보았습니다.
REPOSITORY=/home/ec2-user/backend/
cd $REPOSITORY
echo "> Git Pull"
git pull
echo "> Docker Compose Down"
docker-compose down --rmi all
echo "> Docker Compose Up"
docker-compose up -d --build
dev 브랜치로 부터 pull, 기존 이미지 삭제 후 docker-compose up
version: '3.8'
services:
was:
container_name: server
build:
context: /home/ec2-user/
ports:
- 8080:8080
depends_on:
- mysql
- redis
links:
- mysql
- redis
mysql:
container_name: mysql
image: mysql:latest
volumes:
- /home/ec2-user/docker/mysql/conf:/etc/mysql/conf.d
- /home/ec2-user/docker/mysql/lib:/var/lib/mysql
- /home/ec2-user/docker/mysql/initdb.d:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: '0000'
ports:
- 3306:3306
redis:
container_name: redis
image: redis:latest
ports:
- 6379:6379