Skip to content

Commit e2bb861

Browse files
chore: docker build push job 추가
Co-authored-by: coli-geonwoo <[email protected]>
1 parent 97ce090 commit e2bb861

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: backend cicd dev
2+
3+
on:
4+
push:
5+
branches: [ "feature/19" ]
6+
# paths:
7+
# - backend/**
8+
pull_request:
9+
branches: [ "feature/19" ]
10+
# paths:
11+
# - backend/**
12+
13+
defaults:
14+
run:
15+
working-directory: backend
16+
17+
env:
18+
DOCKERHUB_REPOSITORY: ody-official
19+
20+
jobs:
21+
build-docker-push:
22+
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '17'
33+
distribution: 'temurin'
34+
35+
- name: Setup Gradle
36+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
37+
38+
- name: Build with Gradle Wrapper
39+
run: ./gradlew build
40+
41+
- name: Setup Docker buildx
42+
uses: docker/[email protected]
43+
44+
- name: Login to Docker Hub
45+
uses: docker/[email protected]
46+
with:
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
49+
50+
- name: Docker Image Build
51+
run: |
52+
echo "========== 현위치 : "
53+
pwd
54+
docker build --platform linux/amd64,linux/x64/v8 -t ${{ secrets.DOCKERHUB_USERNAME }}/$DOCKERHUB_REPOSITORY:${{ github.sha }} -f ./Dockerfile
55+
56+
- name: Docker Hub Push
57+
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/$DOCKERHUB_REPOSITORY:${{ github.sha }}

backend/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM openjdk:17-jdk
2+
3+
ARG JAR_FILE=./build/libs/*.jar
4+
5+
COPY ${JAR_FILE} /ody-backend.jar
6+
7+
ENTRYPOINT ["java", "-jar", "-Duser.timezone=Asia/Seoul", "/ody-backend"]

0 commit comments

Comments
 (0)