Skip to content

Commit

Permalink
[chore] : docker compose 활용한 CD 구축 (#161)
Browse files Browse the repository at this point in the history
* [chore] : docker compose로 컨테이너 일괄 실행

* [chore] docker compose 파일 수정
  • Loading branch information
hyun2371 authored Apr 12, 2024
1 parent 6acf9cd commit 0747fba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 35 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ jobs:
password: ${{ secrets.EC2_PASSWORD }}
port: ${{ secrets.EC2_PORT }}
script: |
cd compose
docker rm -f $(docker ps -qa)
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_APP_NAME }}
docker stop ${{ secrets.DOCKERHUB_APP_NAME }}
docker rm ${{ secrets.DOCKERHUB_APP_NAME }}
docker run -d \
-p 8080:8080 \
-e TZ=Asia/Seoul \
--name ${{ secrets.DOCKERHUB_APP_NAME }} \
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_APP_NAME }}
docker-compose up -d
docker system prune -f
31 changes: 4 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
version: "3"
services:
server:
image: openjdk:17-alpine
container_name: spring_server_hands_up
restart: always
depends_on:
- db-master
- redis
volumes:
- ./api/build/libs:/home
command: ["java", "-jar", "/home/api-0.0.1-SNAPSHOT.jar"]
ports:
- '8080:8080'
platform: linux/amd64

db-master:
image: mysql:8.0
container_name: master_db_hands_up
environment:
MYSQL_DATABASE: master_db_hands_up
MYSQL_ROOT_PASSWORD: ${MASTER_PASSWORD}
ports:
- "3306:3306"

redis:
image: redis:latest
container_name: redis_hands_up
image: redis
container_name: hands-up-redis
ports:
- '6379:6379'
platform: linux/amd64
- "6379:6379"
restart: always

0 comments on commit 0747fba

Please sign in to comment.