Skip to content

Commit 35d22db

Browse files
committed
updates
1 parent b3771da commit 35d22db

File tree

7 files changed

+69
-153
lines changed

7 files changed

+69
-153
lines changed

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

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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: Set up Docker Buildx
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v2
20+
21+
# Step 3: Log in to Docker Hub using GitHub secrets
22+
- name: Log in to Docker Hub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
# Step 4: Build the Docker image for multiple platforms (amd64 and arm64)
29+
- name: Build Docker image for amd64 and arm64
30+
run: |
31+
docker buildx build --platform linux/amd64,linux/arm64 -t devadathanmb/ktu-bot:latest --push .

.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

+36-4
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
16+
17+
# Copy package files and install dependencies
18+
COPY package.json package-lock.json ./
519
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
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)