File tree 7 files changed +70
-153
lines changed
7 files changed +70
-153
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Push Docker Image
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - prod # Trigger branch
7
+
8
+ jobs :
9
+ build_and_push :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ # Step 1: Checkout the code
14
+ - name : Checkout code
15
+ uses : actions/checkout@v2
16
+
17
+ # Step 2: Log in to Docker Hub using GitHub secrets
18
+ - name : Log in to Docker Hub
19
+ uses : docker/login-action@v2
20
+ with :
21
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
22
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
23
+
24
+ # Step 3: Build the Docker image
25
+ - name : Build Docker image
26
+ run : |
27
+ docker build -t devadathanmb/ktu-bot:latest .
28
+
29
+ # Step 4: Push the Docker image to Docker Hub
30
+ - name : Push Docker image to Docker Hub
31
+ run : |
32
+ docker push devadathanmb/ktu-bot:latest
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- FROM node:18-slim
1
+ # FROM node:18-slim
2
+ # WORKDIR /bot
3
+ # COPY package.json /bot
4
+ # COPY package-lock.json /bot
5
+ # RUN npm ci
6
+ # COPY . /bot
7
+ # RUN npm run build
8
+ # CMD ["npm", "run", "start"]
9
+ #
10
+
11
+ # Stage 1: Build Stage
12
+ FROM node:18-slim AS builder
13
+
14
+ # Set working directory
2
15
WORKDIR /bot
3
- COPY package.json /bot
4
- COPY package-lock.json /bot
16
+
17
+ # Copy package files and install dependencies
18
+ COPY package.json package-lock.json ./
5
19
RUN npm ci
6
- COPY . /bot
20
+
21
+ # Copy the rest of the code (after installing dependencies to leverage cache)
22
+ COPY . ./
23
+
24
+ # Run build
7
25
RUN npm run build
26
+
27
+ # Stage 2: Production Stage
28
+ FROM node:18-slim
29
+
30
+ # Set working directory
31
+ WORKDIR /bot
32
+
33
+ # Copy only the necessary files from the build stage
34
+ COPY --from=builder /bot /bot
35
+
36
+ # Install only runtime dependencies (remove dev dependencies)
37
+ RUN npm prune --production
38
+
39
+ # Set the command to start the app
8
40
CMD ["npm" , "run" , "start" ]
Original file line number Diff line number Diff line change 1
1
version : " 3.8"
2
2
services :
3
3
ktu-bot :
4
- build : .
4
+ image : devadathanmb/ktu-bot:latest # Pull the latest image from Docker Hub
5
5
restart : always
6
6
depends_on :
7
7
redis-queue-db :
Original file line number Diff line number Diff line change 1
1
import Axios from "axios" ;
2
2
import { setupCache } from "axios-cache-interceptor" ;
3
3
import commonInterceptor from "./interceptors/common" ;
4
- import recaptchaInterceptor from "./interceptors/recaptcha" ;
5
4
6
5
const axios = setupCache ( Axios , {
7
6
methods : [ "post" ] ,
8
- ttl : 1000 * 60 * 20 ,
7
+ ttl : 1000 * 60 * 30 ,
9
8
} ) ;
10
9
11
10
axios . defaults . timeout = 1000 * 10 ;
12
11
13
12
// Inteceptors
14
13
axios . interceptors . request . use ( commonInterceptor ) ;
15
- // axios.interceptors.request.use(recaptchaInterceptor);
16
14
17
15
export { axios } ;
You can’t perform that action at this time.
0 commit comments