Skip to content

Commit 6e772ac

Browse files
committed
updates
1 parent b3771da commit 6e772ac

File tree

7 files changed

+71
-154
lines changed

7 files changed

+71
-154
lines changed

.github/workflows/build-and-push.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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

.github/workflows/ci.yml

-24
This file was deleted.

.github/workflows/prod-deploy.yml

-70
This file was deleted.

.github/workflows/test-deploy.yml

-51
This file was deleted.

Dockerfile

+37-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
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
215
WORKDIR /bot
3-
COPY package.json /bot
4-
COPY package-lock.json /bot
5-
RUN npm ci
6-
COPY . /bot
16+
17+
# Copy package files and install dependencies
18+
COPY package.json package-lock.json ./
19+
RUN npm ci --production
20+
21+
# Copy the rest of the code (after installing dependencies to leverage cache)
22+
COPY . ./
23+
24+
# Run build
725
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
840
CMD ["npm", "run", "start"]

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "3.8"
22
services:
33
ktu-bot:
4-
build: .
4+
image: devadathanmb/ktu-bot:latest # Pull the latest image from Docker Hub
55
restart: always
66
depends_on:
77
redis-queue-db:

src/api/axios.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import Axios from "axios";
22
import { setupCache } from "axios-cache-interceptor";
33
import commonInterceptor from "./interceptors/common";
4-
import recaptchaInterceptor from "./interceptors/recaptcha";
54

65
const axios = setupCache(Axios, {
76
methods: ["post"],
8-
ttl: 1000 * 60 * 20,
7+
ttl: 1000 * 60 * 30,
98
});
109

1110
axios.defaults.timeout = 1000 * 10;
1211

1312
// Inteceptors
1413
axios.interceptors.request.use(commonInterceptor);
15-
// axios.interceptors.request.use(recaptchaInterceptor);
1614

1715
export { axios };

0 commit comments

Comments
 (0)