Skip to content

Bugfix-Docker is consuming too much resource (PR for Devlop Branch) #2828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f1895b7
some changs
PurnenduMIshra129th Jan 2, 2025
182b201
updated docker.prod
PurnenduMIshra129th Jan 3, 2025
084eeda
updated Dockerfile.prod and dev
PurnenduMIshra129th Jan 4, 2025
1807342
created single compose file for prod and removed development dockerco…
PurnenduMIshra129th Jan 5, 2025
64e52b2
Merge branch 'main-develop' into bugfix/dockerEfficiency-develop
PurnenduMIshra129th Jan 5, 2025
ed3d884
merged branch with upstream
PurnenduMIshra129th Jan 5, 2025
37e57be
again added the docke-compose.dev.yaml , docker-compose.prod.yaml,Doc…
PurnenduMIshra129th Jan 12, 2025
4cbba55
changed package.json, changed start command with minio,commented the …
PurnenduMIshra129th Jan 12, 2025
de65d05
changed according to suggestion
PurnenduMIshra129th Jan 13, 2025
a307751
changed the jq installation to debian syntax
PurnenduMIshra129th Jan 13, 2025
3211756
changed command of minio start
PurnenduMIshra129th Jan 14, 2025
23963fb
updated script of minio and removed unnecessary imports in 2nd stage …
PurnenduMIshra129th Jan 14, 2025
a8dce3d
suggestion from ai
PurnenduMIshra129th Jan 19, 2025
c57a82c
Update docker-compose.dev.yaml line 19
PurnenduMIshra129th Jan 21, 2025
0f494f8
Update docker-compose.dev.yaml line 35
PurnenduMIshra129th Jan 21, 2025
26f26d4
Update docker-compose.dev.yaml line55
PurnenduMIshra129th Jan 21, 2025
2d3661c
Update docker-compose.prod.yaml line 16
PurnenduMIshra129th Jan 21, 2025
6773b68
Update docker-compose.prod.yaml
PurnenduMIshra129th Jan 21, 2025
4bfe7fb
Update docker-compose.prod.yaml
PurnenduMIshra129th Jan 21, 2025
f1fd16d
Update docker-compose.prod.yaml
PurnenduMIshra129th Jan 21, 2025
28c8374
updated by suggestion
PurnenduMIshra129th Jan 21, 2025
fcc9429
updated dockerFiles
PurnenduMIshra129th Jan 21, 2025
b64413c
added npm install in prod
PurnenduMIshra129th Jan 22, 2025
05eef35
Merge branch 'develop' of https://github.com/PalisadoesFoundation/tal…
PurnenduMIshra129th Jan 26, 2025
c21adcc
modify test expectation for getVolunteerRank.spec.ts componennt
PurnenduMIshra129th Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Stage 1: Build stage
FROM node:22-alpine AS builder

WORKDIR /usr/src/app

# Copy only necessary files for dependency installation
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the source files (exclude .dockerignore content)
COPY . .

# Build the application
RUN npm run build

# Remove development dependencies to reduce size For now we will keep them commented out .Once we sure which packages are not used in production we can use it.It will reduce the size of the image around 150MB.
# RUN npm prune --production

# Stage 2: Final stage
FROM node:22-alpine

WORKDIR /usr/src/app

# Copy only the build output, node_modules, and package.json from the builder
COPY --from=builder /usr/src/app/build ./build
COPY --from=builder /usr/src/app/package.json ./package.json
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/locales ./locales
COPY --from=builder /usr/src/app/certs ./certs

# Expose the application port
EXPOSE 4000

# Start the application
CMD ["npm", "run", "prod"]
14 changes: 0 additions & 14 deletions Dockerfile.dev

This file was deleted.

25 changes: 0 additions & 25 deletions Dockerfile.prod

This file was deleted.

39 changes: 30 additions & 9 deletions docker-compose.dev.yaml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
services:
mongo:
# No light weight image is available for mongo
image: mongo:latest
container_name: mongo
restart: unless-stopped
Expand All @@ -11,7 +12,8 @@ services:
deploy:
resources:
limits:
memory: 1G
memory: 512M
cpus: '0.5'
ports:
- "127.0.0.1:27017:27017"
volumes:
Expand All @@ -22,15 +24,21 @@ services:
entrypoint: ["/bin/bash", "/init-mongo.sh"]

redis-stack-server:
image: redis/redis-stack-server:latest
image: redis:8.0-M02-alpine
ports:
- 6379:6379
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
volumes:
- redis-data:/data/redis
networks:
- talawa-network

minio:
# No light weight image is available
image: minio/minio
ports:
- "9000:9000"
Expand All @@ -39,20 +47,24 @@ services:
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
command: server /data --console-address ":9001"
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
volumes:
- minio-data:/data
networks:
- talawa-network

talawa-api-dev:
talawa-api-prod:
build:
context: .
dockerfile: Dockerfile.dev
container_name: talawa-api-dev
dockerfile: Dockerfile
container_name: talawa-api
ports:
- "4000:4000"
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
depends_on:
mongo:
Expand All @@ -65,8 +77,14 @@ services:
- MONGO_DB_URL=mongodb://mongo:27017/talawa-api?replicaSet=rs0&directConnection=true
- REDIS_HOST=redis-stack-server
- REDIS_PORT=6379
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
networks:
- talawa-network

caddy:
image: caddy/caddy:2.2.1-alpine
container_name: caddy-service
Expand All @@ -79,8 +97,12 @@ services:
- $PWD/site:/srv
- caddy_data:/data
- caddy_config:/config
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'


volumes:
redis-data:
minio-data:
Expand All @@ -89,5 +111,4 @@ volumes:
caddy_config:

networks:
talawa-network:
driver: bridge
talawa-network:
57 changes: 0 additions & 57 deletions docker-compose.prod.yaml

This file was deleted.

Loading