Skip to content

Commit

Permalink
Merge pull request #98 from platinouss/feature/231114-cicd
Browse files Browse the repository at this point in the history
Feature(#5): backend CI/CD ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ•
  • Loading branch information
tmddus2 authored Nov 14, 2023
2 parents 12a757f + ceb3e0a commit 182c188
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/github_actions_cd.yml
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
24 changes: 24 additions & 0 deletions .github/workflows/github_actions_ci.yml
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
5 changes: 5 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.env
Dockerfile
dist
node_modules
8 changes: 8 additions & 0 deletions backend/Dockerfile
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

0 comments on commit 182c188

Please sign in to comment.