Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
[BE] chore: 백엔드 컨테이너 이미지 분리 (#556)
Browse files Browse the repository at this point in the history
chore: 백엔드 컨테이너 이미지 분리
  • Loading branch information
Eun-chan Cho committed Oct 6, 2023
1 parent 119d714 commit 288317c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 100 deletions.
98 changes: 49 additions & 49 deletions .github/workflows/build-be-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,68 @@ on:
branches:
- develop
paths:
- 'backend/**'
- "backend/**"
workflow_dispatch:

permissions:
contents: read

jobs:
jobs:
build:
runs-on: ubuntu-latest
steps:
## jdk setting
- uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin' # https://github.com/actions/setup-java
cache: gradle
## jdk setting
- uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin" # https://github.com/actions/setup-java
cache: gradle

## gradle caching
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
.gradle/caches
.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-
## gradle caching
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
.gradle/caches
.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-
## gradle build
- name: Test with Gradle
run: |
cd ./backend
./gradlew test
- name: Build with Gradle
run: |
cd ./backend
./gradlew build -x test
## gradle build
- name: Test with Gradle
run: |
cd ./backend
./gradlew test
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build with Gradle
run: |
cd ./backend
./gradlew build -x test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-backend-dev:latest
platforms: linux/arm64

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-backend:latest
platforms: linux/arm64

deploy:
needs: build
uses: ./.github/workflows/deploy-dev.yml
Expand Down
100 changes: 50 additions & 50 deletions .github/workflows/build-be-prod.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
name: CICD for Backend Production
name: CICD for Backend Production

on:
push:
branches:
- main
paths:
- 'backend/**'
- "backend/**"
workflow_dispatch:

permissions:
contents: read

jobs:
jobs:
build:
runs-on: ubuntu-latest
steps:
## jdk setting
- uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin' # https://github.com/actions/setup-java
cache: gradle
## jdk setting
- uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin" # https://github.com/actions/setup-java
cache: gradle

## gradle caching
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
.gradle/caches
.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-
## gradle caching
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
.gradle/caches
.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-
## gradle build
- name: Test with Gradle
run: |
cd ./backend
./gradlew test
- name: Build with Gradle
run: |
cd ./backend
./gradlew build -x test
## gradle build
- name: Test with Gradle
run: |
cd ./backend
./gradlew test
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build with Gradle
run: |
cd ./backend
./gradlew build -x test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-backend-prod:latest
platforms: linux/arm64

- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-backend:latest
platforms: linux/arm64

deploy:
needs: build
uses: ./.github/workflows/deploy-prod.yml
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- 3000

backend:
image: ${DOCKER_USERNAME}/dong-gle-backend
image: ${DOCKER_USERNAME}/dong-gle-backend-${INFRA_PROFILE}
expose:
- 8080
volumes:
Expand Down

0 comments on commit 288317c

Please sign in to comment.