Skip to content

Commit

Permalink
deploy test
Browse files Browse the repository at this point in the history
  • Loading branch information
eldpswp99 committed Oct 25, 2023
1 parent e98e3f1 commit 8f6f6cb
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/publish-backend-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 배포

on:
push:
branches:
- backend-deploy

jobs:

push:
env:
working-directory: ./backend
runs-on: ubuntu-latest
if: github.event_name == 'push'


steps:
- uses: actions/checkout@v2

- name: create dotenv
working-directory: ${{env.working-directory}}
run: echo "${{ secrets.ENV }}" > .env

- name: Log into GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build image
working-directory: ${{env.working-directory}}
run: |
docker build -f Dockerfile .\
-t ghcr.io/snuhcs-course/swpp-2023-project-team-13/backend-image:${GITHUB_SHA}\
-t ghcr.io/snuhcs-course/swpp-2023-project-team-13/backend-image:latest
- name: Push image
working-directory: ${{env.working-directory}}
run: |
ghcr.io/snuhcs-course/swpp-2023-project-team-13/backend-image:${GITHUB_SHA}
ghcr.io/snuhcs-course/swpp-2023-project-team-13/backend-image:latest
deploy:
needs: push
name: 배포
runs-on: [ self-hosted ]
steps:
- name: Log into GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker compose up
run: SHA=${GITHUB_SHA} docker-compose -f ~/docker-compose.yml up -d postgres fooriend-backend
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ lerna-debug.log*
!.vscode/launch.json
!.vscode/extensions.json

.env.dev
.env.dev
.env
21 changes: 21 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:20-bullseye-slim

RUN apt-get update \
&& apt-get install -y wget libpq-dev g++ make build-essential \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app


COPY . .

RUN npm install && npm run build

RUN rm -r src

EXPOSE 8765


ENV NODE_ENV=production
ENTRYPOINT ["npm","run","start:prod"]

0 comments on commit 8f6f6cb

Please sign in to comment.