Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
devadathanmb committed Jan 3, 2025
1 parent b3771da commit 6e772ac
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 154 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker Image

on:
push:
branches:
- prod # Trigger branch

jobs:
build_and_push:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v2

# Step 2: Log in to Docker Hub using GitHub secrets
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build -t devadathanmb/ktu-bot:latest .
# Step 4: Push the Docker image to Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker push devadathanmb/ktu-bot:latest
24 changes: 0 additions & 24 deletions .github/workflows/ci.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .github/workflows/prod-deploy.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/test-deploy.yml

This file was deleted.

42 changes: 37 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
FROM node:18-slim
# FROM node:18-slim
# WORKDIR /bot
# COPY package.json /bot
# COPY package-lock.json /bot
# RUN npm ci
# COPY . /bot
# RUN npm run build
# CMD ["npm", "run", "start"]
#

# Stage 1: Build Stage
FROM node:18-slim AS builder

# Set working directory
WORKDIR /bot
COPY package.json /bot
COPY package-lock.json /bot
RUN npm ci
COPY . /bot

# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci --production

# Copy the rest of the code (after installing dependencies to leverage cache)
COPY . ./

# Run build
RUN npm run build

# Stage 2: Production Stage
FROM node:18-slim

# Set working directory
WORKDIR /bot

# Copy only the necessary files from the build stage
COPY --from=builder /bot /bot

# Install only runtime dependencies (remove dev dependencies)
RUN npm prune --production

# Set the command to start the app
CMD ["npm", "run", "start"]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.8"
services:
ktu-bot:
build: .
image: devadathanmb/ktu-bot:latest # Pull the latest image from Docker Hub
restart: always
depends_on:
redis-queue-db:
Expand Down
4 changes: 1 addition & 3 deletions src/api/axios.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import Axios from "axios";
import { setupCache } from "axios-cache-interceptor";
import commonInterceptor from "./interceptors/common";
import recaptchaInterceptor from "./interceptors/recaptcha";

const axios = setupCache(Axios, {
methods: ["post"],
ttl: 1000 * 60 * 20,
ttl: 1000 * 60 * 30,
});

axios.defaults.timeout = 1000 * 10;

// Inteceptors
axios.interceptors.request.use(commonInterceptor);
// axios.interceptors.request.use(recaptchaInterceptor);

export { axios };

0 comments on commit 6e772ac

Please sign in to comment.