-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from platinouss/feature/231114-cicd
Feature(#5): backend CI/CD ํ์ดํ๋ผ์ธ ๊ตฌ์ถ
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: github_actions_cd | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
paths-ignore: | ||
- 'frontend/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: self-hosted | ||
steps: | ||
- name: pull Docker image | ||
run: sudo docker pull ${{secrets.DOCKERHUB_USERNAME}}/boarlog-backend:latest | ||
- name: delete old docker container | ||
run: sudo docker rm -f boarlog-backend-container || true | ||
- name: run docker container | ||
run: sudo docker run -d -p 8000:3000 --name boarlog-backend-container ${{secrets.DOCKERHUB_USERNAME}}/boarlog-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: github_actions_ci | ||
|
||
on: | ||
push: | ||
branches: ["dev"] | ||
paths-ignore: | ||
- 'frontend/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Dockerhub Login | ||
env: | ||
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}} | ||
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_TOKEN}} | ||
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | ||
- name: Build Docker image | ||
run: docker build -t boarlog-backend ./backend | ||
- name: taging | ||
run: docker tag boarlog-backend:latest ${{secrets.DOCKERHUB_USERNAME}}/boarlog-backend:latest | ||
- name: push to Dockerhub | ||
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/boarlog-backend:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git | ||
.env | ||
Dockerfile | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM node:18 | ||
WORKDIR /app | ||
COPY package*.json . | ||
RUN npm install | ||
COPY /backend . | ||
RUN npm run build | ||
RUN npm test | ||
CMD npm run start:prod |