File tree 4 files changed +39
-2
lines changed
4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker Image CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ "dev" ]
6
+ jobs :
7
+ build :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - uses : actions/checkout@v4
11
+ - name : Log in to Docker Hub
12
+
13
+ with :
14
+ username : ${{ secrets.DOCKER_USERNAME }}
15
+ password : ${{ secrets.DOCKER_PASSWORD }}
16
+ - name : Set up QEMU
17
+ uses : docker/setup-qemu-action@v3
18
+ - name : Set up Docker Buildx
19
+ uses : docker/setup-buildx-action@v2
20
+ - name : Build and push Docker image
21
+ id : push
22
+
23
+ with :
24
+ platforms : linux/amd64,linux/arm64
25
+ context : .
26
+ file : ./Dockerfile
27
+ push : true
28
+ tags : overtrue/gradient-bot:dev
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ ADD . /app/
30
30
# install dependencies
31
31
RUN npm install --omit=dev
32
32
RUN npm install pm2 -g
33
+ RUN pm2 install pm2-logrotate
34
+ RUN pm2 set pm2-logrotate:compress true
35
+ RUN pm2 set pm2-logrotate:dateFormat YYYY-MM-DD_HH-mm-ss
36
+ RUN pm2 set pm2-logrotate:rotateInterval '*/5 * * * *'
37
+ RUN pm2 set pm2-logrotate:max_size 10M
38
+ RUN pm2 set pm2-logrotate:retain 2
33
39
RUN SE_AVOID_BROWSER_DOWNLOAD=false SE_OFFLINE=false ./node_modules/selenium-webdriver/bin/linux/selenium-manager --browser chrome --output SHELL --browser-version $SE_BROWSER_VERSION
34
40
RUN chmod +x /app/entrypoint.sh
35
41
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ pm2 flush
4
+ pm2 delete all
5
+
3
6
node /app/start.js
4
7
5
8
pm2 logs
Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ if (!USER || !PASSWORD) {
25
25
26
26
if ( proxies . length === 0 ) {
27
27
console . error ( "No proxies found in proxies.txt, will start app without proxy..." )
28
- execSync ( `APP_USER='${ USER } ' APP_PASS='${ PASSWORD } ' pm2 start app.js --name gradient-bot-no-proxy` )
28
+ execSync ( `APP_USER='${ USER } ' APP_PASS='${ PASSWORD } ' pm2 start app.js --name gradient-bot-no-proxy -l gradient-bot-no-proxy.log ` )
29
29
console . log ( '-> √ Started gradient-bot-no-proxy' )
30
30
} else {
31
31
console . log ( `-> Found ${ proxies . length } proxies in proxies.txt` )
32
32
let index = 0
33
33
for ( const proxy of proxies ) {
34
34
const name = `gradient-${ index ++ } `
35
- execSync ( `PROXY=${ proxy } APP_USER='${ USER } ' APP_PASS='${ PASSWORD } ' pm2 start app.js --name ${ name } ` )
35
+ execSync ( `PROXY=${ proxy } APP_USER='${ USER } ' APP_PASS='${ PASSWORD } ' pm2 start app.js --name ${ name } -l ${ name } .log ` )
36
36
console . log ( `-> Started ${ name } with proxy ${ proxy } ` )
37
37
}
38
38
You can’t perform that action at this time.
0 commit comments