-
Notifications
You must be signed in to change notification settings - Fork 0
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 #5 from LearnMate-Dev/feature/3-implements-deploy-…
…settings [Feature] Implements Deploy Settings
- Loading branch information
Showing
8 changed files
with
95 additions
and
3 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,41 @@ | ||
name: Build and Push Docker Image with Jib | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout Repository and Submodules | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.ACTIONS_TOKEN }} | ||
|
||
- name: Copy application.yml from submodule | ||
run: | | ||
mkdir -p src/main/resources | ||
cp application-config/application-prod.yml src/main/resources/application-prod.yml | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "21" | ||
distribution: "temurin" | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
./gradlew jib -x test \ | ||
-Djib.to.tags=${{ github.sha }} \ | ||
-Djib.to.auth.username=${{ secrets.DOCKER_USERNAME }} \ | ||
-Djib.to.auth.password=${{ secrets.DOCKER_PASSWORD }} | ||
- name: Push Docker image to EC2 server | ||
env: | ||
DOCKER_IMAGE: "${{ secrets.DOCKER_USERNAME }}/learnMate:${{ github.sha }}" | ||
run: | | ||
ssh -o "StrictHostKeyChecking=no" -i ${{ secrets.EC2_SSH_KEY }} ec2-user@${{ secrets.EC2_HOST }} "docker pull $DOCKER_IMAGE && docker run -d -p 8080:8080 $DOCKER_IMAGE" |
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 |
---|---|---|
|
@@ -61,3 +61,6 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### env | ||
.env |
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,4 @@ | ||
services: | ||
app: | ||
env_file: | ||
- .env |
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
15 changes: 15 additions & 0 deletions
15
src/main/resources/application-config/application-prod.yml
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,15 @@ | ||
spring: | ||
application: | ||
name: The_Monitor | ||
|
||
config: | ||
import: optional:file:.env[.properties] | ||
datasource: | ||
url: ${DATABASE_URL} | ||
username: ${DATABASE_USERNAME} | ||
password: ${DATABASE_PASSWORD} | ||
|
||
jwt: | ||
secret_key: ${JWT_SECRET_KEY} | ||
access_token_expire: ${JWT_ACCESS_TOKEN_EXPIRE} | ||
refresh_token_expire: ${JWT_REFRESH_TOKEN_EXPIRE} |
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,10 @@ | ||
spring: | ||
application: | ||
name: The_Monitor | ||
|
||
profiles: | ||
active: local | ||
group: | ||
local: "local" | ||
dev: "dev" | ||
prod: "prod" |
This file was deleted.
Oops, something went wrong.