Skip to content

Commit

Permalink
개발 운영 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
HwangHoYoon committed Jan 14, 2024
1 parent 1c74f07 commit eeb4136
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/gradle-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle Docker

on:
push:
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:
runs-on: devserver

steps:
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.SUB_TOKEN }}
submodules: true

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

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

- name: Build with Gradle
run: ./gradlew build -x test

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/chwipoclovadocker -f Dockerfile.dev .
docker push ${{ secrets.DOCKER_REPO }}/chwipoclovadocker
- name: Deploy
run: |
docker stop be-con || true
docker rm -f be-con || true
docker rmi $(docker images -f "dangling=true" -q) || true
docker pull ${{ secrets.DOCKER_REPO }}/chwipoclovadocker:latest
docker run -v /var/log/service:/var/log/service -v /var/upload:/var/upload --name be-con -p 8080:8080 -d ${{ secrets.DOCKER_REPO }}/chwipoclovadocker:latest
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

jobs:
build:
runs-on: self-hosted
runs-on: apiserver1

steps:
- name: checkout
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/chwipoclovadocker .
docker build -t ${{ secrets.DOCKER_REPO }}/chwipoclovadocker -f Dockerfile.real .
docker push ${{ secrets.DOCKER_REPO }}/chwipoclovadocker
- name: Deploy
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-jdk
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} chwipoClova-0.0.1-SNAPSHOT.jar
ENV TZ Asia/Seoul
ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar","/chwipoClova-0.0.1-SNAPSHOT.jar"]
File renamed without changes.

0 comments on commit eeb4136

Please sign in to comment.