-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3771da
commit 6e772ac
Showing
7 changed files
with
71 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |