Skip to content

Commit b936986

Browse files
authored
Crew deploy test (#39)
* feature: deploy test/dockerfile,properties 추가 * Create deploy.yml
1 parent 817f47c commit b936986

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy Crew App
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: SSH to EC2 and deploy
17+
uses: appleboy/ssh-action@master
18+
with:
19+
host: ${{ secrets.EC2_HOST }}
20+
username: ${{ secrets.EC2_USER }}
21+
key: ${{ secrets.EC2_PRIVATE_KEY }}
22+
script: |
23+
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
24+
docker pull bjisu/crew-app:latest
25+
docker stop crew-app || true
26+
docker rm crew-app || true
27+
docker run -d --name crew-app -p 8080:8080 \
28+
-e DB_USERNAME=${{ secrets.DB_USERNAME }} \
29+
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
30+
bjisu/crew-app:latest

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openjdk:21-jdk-slim
2+
3+
WORKDIR /app
4+
5+
COPY build/libs/*.jar app.jar
6+
7+
ENV SPRING_PROFILES_ACTIVE=prod
8+
9+
EXPOSE 8080
10+
11+
ENTRYPOINT ["java", "-jar", "app.jar"]

src/main/resources/application.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
spring:
22
application:
33
name: crew
4-
#JPA
4+
#JPA
55
datasource:
6-
driver-class-name: org.h2.Driver
7-
url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL
6+
driver-class-name: com.mysql.cj.jdbc.Driver
7+
url: jdbc:mysql://retripstudydb.cv4sss0i0mk8.ap-southeast-2.rds.amazonaws.com:3306/crew?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
8+
username: ${DB_USERNAME}
9+
password: ${DB_PASSWORD}
810
jpa:
911
hibernate:
10-
ddl-auto: create-drop
12+
ddl-auto: update
1113
properties:
1214
hibernate:
1315
show_sql: true

0 commit comments

Comments
 (0)