-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from yeong-hwan/yeong-hwan
[19기_장영환] Github Action을 이용한 CI/CD 배포 미션 제출합니다.
- Loading branch information
Showing
12 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Deploy Development Server | ||
|
||
on: | ||
push: | ||
branches: [ "yeong-hwan" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
## gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew bootJar | ||
|
||
|
||
- name: web docker build and push | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t my-repo/my-web-image . | ||
docker push my-repo/my-web-image | ||
docker build -f dockerfile-nginx -t my-repo/my-nginx-image . | ||
docker push my-repo/my-nginx-image | ||
- name: executing remote ssh commands using password | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.KEY }} | ||
script: | | ||
## 여러분이 원하는 경로로 이동합니다. | ||
cd /home/ubuntu/ | ||
|
||
## .env 파일을 생성합니다. | ||
sudo touch .env | ||
echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null | ||
|
||
## docker-compose.yaml 파일을 생성합니다. | ||
sudo touch docker-compose.yaml | ||
echo "${{ vars.DOCKER_COMPOSE }}" | sudo tee docker-compose.yaml > /dev/null | ||
|
||
## docker-compose를 실행합니다. | ||
sudo chmod 666 /var/run/docker.sock | ||
sudo docker rm -f $(docker ps -qa) | ||
sudo docker pull my-repo/my-web-image | ||
sudo docker pull my-repo/my-nginx-image | ||
docker-compose -f docker-compose.yaml --env-file ./.env up -d | ||
docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
# Use the OpenJDK 17 base image | ||
FROM openjdk:17 | ||
|
||
# Define the build argument with the default value | ||
ARG JAR_FILE=/build/libs/*.jar | ||
|
||
# Print the JAR_FILE variable value for debugging | ||
RUN echo "JAR_FILE is set to ${JAR_FILE}" | ||
|
||
# List files in the current directory for debugging | ||
RUN ls -l . | ||
|
||
# Copy the JAR file to the container | ||
COPY ${JAR_FILE} app.jar | ||
ENTRYPOINT ["java","-jar", "/app.jar"] | ||
|
||
# Specify the entry point to run the application | ||
ENTRYPOINT ["java", "-jar", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3" | ||
|
||
services: | ||
db: | ||
image: mysql:8.0.29-oracle | ||
# image: mariadb:latest #mac | ||
platform: linux/amd64 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: Jyh0914@ | ||
MYSQL_DATABASE: everytime | ||
volumes: | ||
- dbdata:/var/lib/mysql | ||
ports: | ||
- 3306:3306 | ||
restart: always | ||
|
||
web: | ||
container_name: web | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- db | ||
environment: | ||
mysql_host: db | ||
restart: always | ||
volumes: | ||
- app:/app | ||
|
||
|
||
volumes: | ||
dbdata: | ||
app: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
spring: | ||
datasource: | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
url: jdbc:mysql://localhost:3306/everytime?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul?useSSL=false | ||
# url: jdbc:mysql://localhost:8080/everytime?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul?useSSL=false | ||
username: root | ||
password: Jyh0914@ | ||
jpa: | ||
database: mysql | ||
database-platform: org.hibernate.dialect.MySQL8Dialect | ||
hibernate: | ||
ddl-auto: create-drop | ||
properties: | ||
hibernate: | ||
dialect: org.hibernate.dialect.MySQL8Dialect | ||
database-platform: org.hibernate.dialect.MySQL8Dialect | ||
show_sql: true | ||
format_sql: false | ||
defer-datasource-initialization: true | ||
sql: | ||
init: | ||
mode: always | ||
mvc: | ||
pathmatch: | ||
matching-strategy: ant_path_matcher | ||
|
||
|
||
|
||
server: | ||
port: 8080 | ||
servlet: | ||
contextPath: /ceos-everytime | ||
|
||
springdoc: | ||
api-docs: | ||
enabled: true | ||
swagger-ui: | ||
enabled: true | ||
tagsSorter: alpha | ||
operations-sorter: alpha | ||
display-request-duration: true | ||
|
||
jwt: | ||
header: Authorization | ||
#HS512 알고리즘을 사용할 것이기 때문에 512bit, 즉 64byte 이상의 secret key를 사용해야 한다. | ||
secret: a2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbXRva2FyaW10b2thcmltdG9rYXJpbQ== | ||
token-validity-in-seconds: 86400 # ttl (초) |