-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
3 changed files
with
97 additions
and
0 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,80 @@ | ||
name: Pull Request on Check | ||
on: | ||
push: | ||
branches: | ||
- "chore/#24-elastic-beanstalk-deploy" | ||
|
||
env: | ||
DOCKERHUB_IMAGE_NAME: walwal-server | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java-version: [ 17 ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: 'zulu' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
# Gradle 빌드 | ||
- name: Build with Gradle | ||
id: gradle | ||
uses: gradle/gradle-build-action@v3 | ||
with: | ||
arguments: | | ||
build | ||
--scan | ||
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} | ||
|
||
- name: Docker build | ||
run: | | ||
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }} . | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }} | ||
- name: Current Time | ||
uses: gerred/[email protected] | ||
id: current-time | ||
|
||
- name: Replace string | ||
uses: frabert/[email protected] | ||
id: format-time | ||
with: | ||
pattern: '[:\.]+' | ||
string: "${{ steps.current-time.outputs.time }}" | ||
replace-with: '-' | ||
flags: 'g' | ||
|
||
# 슬랙으로 빌드 스캔 결과 전송 | ||
- name: Send to slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "Gradle Build Scan Report of ${{ github.workflow }}: ${{ steps.gradle.outputs.build-scan-url }}" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
# Beanstalk 플러그인을 사용 | ||
# 미리 생성해둔 IAM 인증키를 사용 | ||
- name: Beanstalk Deploy | ||
uses: einaregilsson/beanstalk-deploy@v20 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
application_name: "walwal-server" | ||
environment_name: "walwal-server-env" | ||
version_label: "github-action-${{ steps.format-time.outputs.replaced }}" | ||
region: ap-northeast-2 | ||
deployment_package: Dockerrun.aws.json |
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 @@ | ||
FROM azul/zulu-openjdk:17-latest | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"AWSEBDockerrunVersion": "1", | ||
"Image": { | ||
"Name": "olderstonebed/walwal-server:latest", | ||
"Update": "true" | ||
}, | ||
"Ports": [ | ||
{ | ||
"ContainerPort": 8080, | ||
"HostPort": 5000 | ||
} | ||
] | ||
} |