Skip to content

Commit

Permalink
Merge pull request #16 from gaaji/GM-176
Browse files Browse the repository at this point in the history
GM-176 GithubAction CI 설정파일, Dockerfile 생성
  • Loading branch information
kgh2120 authored Feb 1, 2023
2 parents fedda1b + 6f9ac12 commit efc6b20
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/PR_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Issue# - Issue
## Description
>
## PR Type
- [ ] Hotfix
- [ ] Feature
- [ ] Code style update
- [ ] Refactor (code, package, etc.)
- [ ] Build (gradle, spring, etc)
- [ ] Documentation content changes (api docs, etc.)
- [ ] Infra (cloud, security, etc.)
- [ ] Other... Please describe :

## Related Issues
-

## Issues

### Test

***

## Related Files
- `file`

## Think About..

## Conclusion
>
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@


name: Java CI with Gradle

on:
pull_request:


permissions:
contents: read

env:
DOCKER_IMAGE: ghcr.io/${{ github.actor }}/gaaji-auth-service
VERSION: ${{ github.sha }}


jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Create secret.yml
env:
SECRET_CODE: ${{ secrets.SECRET }}
SECRET_DIR: src/main/resources
SECRET_FILE_NAME: secret.yml
run: echo $SECRET_CODE | base64 --decode > $SECRET_DIR/$SECRET_FILE_NAME

- name: Create application-oauth.yml
env:
SECRET_CODE: ${{ secrets.OAUTH }}
SECRET_DIR: src/main/resources
SECRET_FILE_NAME: application-oauth.yml
run: echo $SECRET_CODE | base64 --decode > $SECRET_DIR/$SECRET_FILE_NAME

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name : Set Eureka Server
run: |
docker pull ${{ secrets.EUREKA }}
docker run -d -p 8761:8761 ${{ secrets.EUREKA }}
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build

- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: show directory
run: ls

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: . # dockerfile이 있는 위치랑 맞춰주자
file: ./Dockerfile # 빌드할 Dockerfile이 있는 디렉토리
push: true
tags: ${{ env.DOCKER_IMAGE }}:local
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-alpine
VOLUME /tmp
COPY build/libs/auth-0.0.1-SNAPSHOT.jar api.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar", "api.jar"]

0 comments on commit efc6b20

Please sign in to comment.