This repository was archived by the owner on Apr 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # The ID of your GitHub App.
2- APP_ID =
3- WEBHOOK_SECRET = development
4-
5- # Use `trace` to get verbose logging or `info` to show less.
6- LOG_LEVEL = debug
7-
8- # Go to https://smee.io/new set this to the URL that you are redirected to.
9- WEBHOOK_PROXY_URL =
10-
111# App working port.
12- PORT =
2+ PORT = 3100
133
144# Bot database host.
155BOT_DB_HOST =
@@ -22,3 +12,16 @@ BOT_DB_PASSWORD=
2212
2313# Bot database name.
2414BOT_DB_NAME =
15+
16+ # Bot name
17+ BOT_NAME : " "
18+
19+ # The ID of your GitHub App.
20+ APP_ID =
21+ WEBHOOK_SECRET = development
22+
23+ # Use `trace` to get verbose logging or `info` to show less.
24+ LOG_LEVEL = debug
25+
26+ # Go to https://smee.io/new set this to the URL that you are redirected to.
27+ WEBHOOK_PROXY_URL =
Original file line number Diff line number Diff line change 1+ name : Publish Docker Image
2+ on :
3+ push :
4+ tags :
5+ - ' v*.*.*'
6+ jobs :
7+ publish :
8+ name : Publish
9+ runs-on : ubuntu-18.04
10+ steps :
11+ - name : Checkout
12+ uses : actions/checkout@v1
13+ # Generate image tag name, one is with the version number, the other is the latest version.
14+ - name : Docker meta
15+ id : docker_meta
16+ uses : crazy-max/ghaction-docker-meta@v1
17+ with :
18+ images : ${{ secrets.DOCKERHUB_USERNAME }}/ti-community-bot
19+ # The v2 version of docker/build-push-action uses Docker Buildx to build.
20+ - name : Docker Setup Buildx
21+ uses : docker/setup-buildx-action@v1.1.1
22+ - name : Login to Docker Hub
23+ uses : docker/login-action@v1
24+ with :
25+ username : ${{ secrets.DOCKERHUB_USERNAME }}
26+ password : ${{ secrets.DOCKERHUB_TOKEN }}
27+ - name : Build and push
28+ id : docker_build
29+ uses : docker/build-push-action@v2
30+ with :
31+ push : true
32+ context : .
33+ file : prod.Dockerfile
34+ tags : ${{ steps.docker_meta.outputs.tags }}
35+ labels : ${{ steps.docker_meta.outputs.labels }}
36+ env :
37+ # NOTICE: Do not use the built-in GITHUB_TOKEN, as this will cause the events of other workflows that cannot be triggered.
38+ GITHUB_TOKEN : ${{ secrets.CUSTOM_GITHUB_TOKEN }}
39+ - name : Image digest
40+ run :
41+ echo ${{ steps.docker_build.outputs.digest }}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1616- Docker
1717- Docker Compose >= 3
1818
19- ## Setup
19+ ## Development
2020
2121``` sh
22- # Install dependencies
23- npm install
22+ # Copy .env.example to .env (fill in the relevant environment variables)
23+ copy .env.example .env
2424
25- # Run with hot reload
26- npm run build:watch
25+ # docker-compose up the db and bot
26+ docker-compose -f dev.docker-compose.yml up -d --build
27+ ```
28+
29+ ### Changing code
30+
31+ The directory is mounted directly into the bot Docker container, which means that the nodemon live-reload server will still just work.
32+
33+ If you change some configuration files or environment variables, we need to restart the service to take effect.
2734
28- # Compile and run
29- npm run build
30- npm run start
35+ ``` sh
36+ # Rebuild bot Docker image
37+ docker-compose -f dev.docker-compose.yml build bot
38+
39+ # Restart running frontend container (if it's already running)
40+ docker-compose -f dev.docker-compose.yml stop bot
41+ docker-compose -f dev.docker-compose.yml rm bot
42+ docker-compose -f dev.docker-compose.yml up -d
3143```
3244
3345## Deploy
3446
35- ``` sh
36- # Docker compose up
37- docker-compose up -d --build
47+ Deploy using the docker-compose file of the production environment.
3848
49+ ``` sh
50+ # docker-compose up the bot
51+ docker-compose -f prod.docker-compose.yml up -d
3952```
4053
4154## Contributing
Original file line number Diff line number Diff line change 1+ FROM node:14-alpine
2+
3+ WORKDIR /usr/src/app
4+
5+ COPY package*.json ./
6+
7+ RUN apk --no-cache --virtual build-dependencies add \
8+ python \
9+ make \
10+ g++
11+
12+ RUN npm install
13+
14+ COPY . ./
15+
16+ EXPOSE 3000
17+ CMD ["npm" , "run" , "dev" ]
Original file line number Diff line number Diff line change @@ -14,5 +14,20 @@ services:
1414 volumes :
1515 - ./init.sql:/data/application/init.sql
1616 - mysql-data:/var/lib/mysql
17+ ti-community-bot :
18+ build :
19+ context : .
20+ dockerfile : dev.Dockerfile
21+ restart : always
22+ entrypoint : npm run dev
23+ depends_on :
24+ - db
25+ links :
26+ - db
27+ ports :
28+ - 3100:3100
29+ volumes :
30+ # Mount the directory so live reload works.
31+ - .:/usr/src/app
1732volumes :
1833 mysql-data :
Original file line number Diff line number Diff line change 1+ FROM node:14-alpine as builder
2+
3+ WORKDIR /usr/src/app
4+
5+ COPY package*.json ./
6+
7+ RUN apk --no-cache --virtual build-dependencies add \
8+ python \
9+ make \
10+ g++
11+
12+ RUN npm install
13+
14+ FROM node:14-alpine as app
15+
16+ WORKDIR /usr/src/app
17+
18+ COPY --from=builder /usr/src/app/node_modules/ ./node_modules/
19+
20+ COPY . ./
21+ RUN rm -rf /usr/src/app/lib
22+
23+ RUN npm run build
24+
25+ ENV NODE_ENV="production"
26+ EXPOSE 3100
27+
28+ CMD [ "npm" , "start" ]
Original file line number Diff line number Diff line change 1+ version : ' 3'
2+
3+ services :
4+ ti-community-bot :
5+ image : ti-community-bot:latest
6+ environment :
7+ PORT : " 3100"
8+ BOT_DB_HOST : " "
9+ BOT_DB_PORT : " "
10+ BOT_DB_PASSWORD : " "
11+ BOT_DB_NAME : " "
12+ BOT_NAME : " "
13+ WEBHOOK_PROXY_URL : " "
14+ APP_ID : " "
15+ PRIVATE_KEY : " "
16+ entrypoint : npm start
17+ ports :
18+ - 3100:3100
19+ restart : always
You can’t perform that action at this time.
0 commit comments