Skip to content

Commit

Permalink
Merge pull request #27 from codestates-seb/dev-server#08/devops
Browse files Browse the repository at this point in the history
[Feat] 백엔드 서버 CI 구현
  • Loading branch information
yjy8501 authored Aug 29, 2023
2 parents 2b99e3e + 4cfcbe9 commit f3bdf12
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions server/008main_project/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Java CI with Gradle

on:
pull_request:
branches: [ dev-server, main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'zulu'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
docker buildx build --push --platform linux/amd64,linux/arm64 -t ${{ secrets.DOCKER_HUB_USERNAME }}/stockholm:${GITHUB_SHA::7} .
11 changes: 11 additions & 0 deletions server/008main_project/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# (1) base-image
FROM openjdk:11

# (2) COPY에서 사용될 경로 변수
ARG JAR_FILE=build/libs/*-SNAPSHOT.jar

# (3) jar 빌드 파일을 도커 컨테이너로 복사
COPY ${JAR_FILE} app.jar

# (4) jar 파일 실행
ENTRYPOINT ["java","-jar","/app.jar"]

0 comments on commit f3bdf12

Please sign in to comment.