Skip to content

Commit

Permalink
infra : dockerfile 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
moonn6pence committed Oct 16, 2023
1 parent 46ba046 commit aa17e84
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
FROM adoptopenjdk:11 AS builder
COPY gradlew .
COPY settings.gradle .
COPY build.gradle .
COPY gradle gradle
COPY src src
RUN chmod +x ./gradlew
RUN ./gradlew build -x test

FROM adoptopenjdk:11
RUN mkdir /opt/app
COPY --from=builder build/libs/*.jar /opt/app/spring-boot-application.jar
EXPOSE 8080
ENV PROFILE local
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=${PROFILE}" ,"/opt/app/spring-boot-application.jar"]
FROM openjdk:11-jdk

VOLUME /tmp

ARG JAR_FILE=./build/libs/*.jar

COPY ${JAR_FILE} app.jar

ENTRYPOINT ["nohup","java","-jar","-Dspring.profiles.active=prod","app.jar","2>&1","&"]
2 changes: 1 addition & 1 deletion appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
group: ubuntu
mode: 755
hooks:
AfterInstall:
ApplicationStart:
- location: scripts/deploy.sh
timeout: 60
runas: ubuntu
13 changes: 13 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 가동중인 ssafsound-app 도커 중단 및 삭제
sudo docker ps -a -q --filter "name=ssafsound-app" | grep -q . && docker stop ssafsound-app && docker rm ssafsound-app | true

# 기존 이미지 삭제
sudo docker rmi kimssafy/ssafsound-app:latest

# 도커허브 이미지 pull
sudo docker pull kimssafy/ssafsound-app:latest

# 도커 run
docker run -d -p 8080:8080 -e TZ=Asia/Seoul -v /home/ubuntu/logs:/logs --name ssafsound-app kimssafy/ssafsound-app:latest

docker rmi -f $(docker images -f "dangling=true" -q) || true

0 comments on commit aa17e84

Please sign in to comment.