Skip to content

Commit

Permalink
build: automate deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
DipokalLab committed May 8, 2023
1 parent a8e5f23 commit d92837d
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 125 deletions.
2 changes: 2 additions & 0 deletions .docker/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE DATABASE IF NOT EXISTS e2echat;
FLUSH PRIVILEGES;
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pakage-lock.json
/node_modules
/dist
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ jobs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: npm install
- run: tsc
- run: npm run bundle
- run: pm2 start npm -- start
# - run: npm install
# - run: tsc
# - run: npm run bundle
# - run: pm2 start npm -- start
- run: docker-compose up
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18
WORKDIR /app
COPY package*.json /app
RUN npm install --global node-gyp
RUN npm install
RUN npm install -g typescript
RUN npm install pm2 -g
COPY . /app
RUN npm i -d @types/node
RUN tsc
RUN npm run bundle
CMD [ "pm2-runtime", "start", "npm", "--", "start" ]
EXPOSE 9023
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.1'

services:

main:
build:
context: .
dockerfile: ./Dockerfile
environment:
DB_CLIENT: mysql
DB_HOST: 172.17.0.1
DB_USER: root
DB_PASS: pi1GfukVsan5UJGugWxF
DB_DATABASE: e2echat
DB_PORT: 13309
NODE_ENV: production
VIRTUAL_HOST: chat.devent.kr
LETSENCRYPT_HOST: chat.devent.kr
LETSENCRYPT_EMAIL: hhj@devent.kr
network_mode: "bridge"


db:
image: mysql:8.0
ports:
- 13309:3306
environment:
MYSQL_ROOT_PASSWORD: pi1GfukVsan5UJGugWxF
volumes:
- .docker/setup.sql:/docker-entrypoint-initdb.d/setup.sql
network_mode: "bridge"

redis:
image: redis:latest
command: redis-server --port 6379
container_name: redis
hostname: redis
labels:
- "name=redis"
- "mode=standalone"
ports:
- 6379:6379
Binary file removed head.png
Binary file not shown.
Loading

0 comments on commit d92837d

Please sign in to comment.