Skip to content

Commit

Permalink
Merge pull request #31 from bariBari23/docker_setup
Browse files Browse the repository at this point in the history
chore: 도커로 테스트 돌리는 기능
  • Loading branch information
mirageoasis authored Jul 13, 2024
2 parents 05dc030 + 59a15d1 commit c28fa7a
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend-config
33 changes: 33 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'
services:
mysql:
image: mysql:8.0.32
hostname: mysql
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: demo
ports:
- "3306:3306"
restart: always

redis:
image: redis:7.0.11
hostname: redis
container_name: redis
ports:
- "6379:6379"
restart: always

spring:
hostname: spring
container_name: spring
build:
context: ..
dockerfile: docker/spring/Dockerfile
ports:
- "8080:8080"
depends_on:
- mysql
- redis
restart: always
27 changes: 27 additions & 0 deletions docker/spring/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM gradle:7.6.1-jdk17-jammy

#RUN yum install -y curl

WORKDIR /app

# Copy the Gradle configuration files and source code
COPY gradlew /app/
COPY gradle /app/gradle
COPY build.gradle.kts /app/
COPY settings.gradle.kts /app/
COPY backend-config /app/backend-config
COPY src /app/src

RUN rm -f /app/src/test/resources/application.yml

# Make the Gradle wrapper executable
RUN chmod +x ./gradlew

# Copy test resources

# run test
RUN ./gradlew copyYmlTest
#RUN cat /app/src/test/resources/application.yml
#RUN ./gradlew test
ENTRYPOINT ["./gradlew", "test"]
#ENTRYPOINT ["tail", "-f", "/dev/null"]
10 changes: 10 additions & 0 deletions scripts/test-end.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# 현재 스크립트의 디렉토리로 이동
cd "$(dirname "$0")"

# Docker Compose 파일이 있는 디렉토리로 이동
cd ../docker

# Docker Compose를 사용하여 서비스 종료
docker-compose down
10 changes: 10 additions & 0 deletions scripts/test-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# 현재 스크립트의 디렉토리로 이동
cd "$(dirname "$0")"

# Docker Compose 파일이 있는 디렉토리로 이동
cd ../docker

# Docker Compose를 사용하여 서비스 시작
docker-compose up --build -d

0 comments on commit c28fa7a

Please sign in to comment.