This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
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.
- Loading branch information
1 parent
35cf3b6
commit a044ad2
Showing
4 changed files
with
91 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,47 @@ | ||
name: Continuous Delivery | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
Delivery: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
DB_URL: ${{ secrets.DB_URL }} | ||
DB_USER: ${{ secrets.DB_USR }} | ||
DB_PASSWORD: ${{ secrets.DB_PWD }} | ||
|
||
steps: | ||
- name: Set up sources | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
submodules: true | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: corretto | ||
cache: gradle | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Execute Gradle build | ||
run: ./gradlew build | ||
|
||
- name: Login to docker-hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build Docker Image | ||
run: docker build --tag goldentrash/plantory:latest . | ||
|
||
- name: Push docker image | ||
run: docker push goldentrash/plantory:latest |
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 @@ | ||
name: Deploy | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
Deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
# Needed for `google-github-actions` | ||
- uses: 'actions/checkout@v4' | ||
|
||
- name: Login to Google | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | ||
|
||
- name: Update docker container | ||
uses: google-github-actions/ssh-compute@v1 | ||
with: | ||
instance_name: plantory | ||
zone: asia-northeast3-a | ||
ssh_private_key: ${{ secrets.GCP_SSH_KEY }} | ||
command: | | ||
docker pull goldentrash/plantory:latest | ||
docker stop plantory | ||
docker run -d --rm -p 8080:8080 --mount type=volume,src=resources,dst=/app/resources --name plantory goldentrash/plantory |
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,9 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM amazoncorretto:17-alpine | ||
|
||
WORKDIR /app | ||
COPY /build/libs/plantory-*-SNAPSHOT.jar app.jar | ||
|
||
EXPOSE 8080 | ||
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