Skip to content

Commit

Permalink
Merge pull request #115 from catchroom/develop
Browse files Browse the repository at this point in the history
fix : docker ์ˆ˜์ •
  • Loading branch information
sungjiwoon authored Feb 7, 2024
2 parents fdf205b + 70baa8a commit 801e568
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML }}" > src/main/resources/application.yml
cat ./src/main/resources/application.yml
echo "${{ secrets.DOCKER-COMPOSE }}" > docker-compose.yml
cat docker-compose.yml
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
Expand All @@ -39,8 +41,6 @@ jobs:
run: |
docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PWD }}
docker buildx build --push --platform linux/amd64 -t ${{ secrets.DOCKER_IMAGE_NAME }} .
# docker build -t ${{ secrets.DOCKER_IMAGE_NAME }} .
# docker push ${{ secrets.DOCKER_IMAGE_NAME }}
- name: Deploy
uses: appleboy/ssh-action@master
Expand All @@ -49,10 +49,11 @@ jobs:
username: ${{ secrets.USER_NAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker image prune -af
sudo docker stop prod1
sudo docker stop prod2
sudo docker pull ${{ secrets.DOCKER_IMAGE_NAME }}
sudo docker stop chat-server-1
sudo docker run -d --rm --name chat-server-1 -p 8081:8080 ${{ secrets.DOCKER_IMAGE_NAME }}
sleep 10
sudo docker stop chat-server-2
sudo docker run -d --rm --name chat-server-2 -p 8082:8080 ${{ secrets.DOCKER_IMAGE_NAME }}
docker-compose up -d
sudo docker image prune -af
# sleep 10
# sudo docker stop chat-server-2
# sudo docker run -d --rm --name chat-server-2 -p 8082:8080 ${{ secrets.DOCKER_IMAGE_NAME }}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM openjdk:17-jdk

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

COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-Dspring.profiles.active=docker", "-jar", "app.jar"]
ENTRYPOINT ["java", "-Dspring.profiles.active=${PROFILES}", "-jar", "app.jar"]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation "org.springframework.boot:spring-boot-starter-actuator"

//redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
public class RedisProperties {
private String host;
private int port;
private String password;
// private String password;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.catchroom.chat.global.healthcheck;

import java.util.Arrays;
import lombok.RequiredArgsConstructor;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/utils")
public class CheckController {
private final Environment env;

@GetMapping("/profile")
public String getProfile() {
return Arrays.stream(env.getActiveProfiles()).findFirst().orElse("");
}
}

0 comments on commit 801e568

Please sign in to comment.