Created
April 9, 2025 21:43
-
-
Save ninadpchaudhari/fe99474e9178134b398718be006da926 to your computer and use it in GitHub Desktop.
Idealy you should use npm build to generate static files from your frontend and have them deployed, but for now, feel free to use this Dockerfile as a reference
This file contains hidden or 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
FROM node:22 as build | |
WORKDIR /app | |
COPY package.json /app/package.json | |
COPY package-lock.json /app/package-lock.json | |
RUN npm install | |
COPY . /app | |
EXPOSE 9000 | |
CMD ["npm", "start"] |
This file contains hidden or 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
# Just a reference compose file. | |
services: | |
frontend: | |
restart: unless-stopped | |
build: | |
context: ./frontend | |
container_name: frontend | |
# ports: | |
# - "3000:3000" | |
env_file: | |
- ./frontend/.env | |
networks: | |
- gi_local_nw | |
backend: | |
restart: unless-stopped | |
build: | |
context: ./backend | |
container_name: backend | |
# ports: | |
# - "9010:9000" | |
environment: | |
- MONGODB_URI=mongodb://gi_mongodb:27017 | |
depends_on: | |
- frontend | |
- mongodb | |
env_file: | |
- ./backend/.env | |
networks: | |
- gi_local_nw | |
# If you need this !? | |
# mongodb: | |
# image: mongo:latest | |
# container_name: gi_mongodb | |
# # ports: | |
# # - "27017:27017" | |
# volumes: | |
# - mongo_data:/data/db | |
# networks: | |
# - gi_local_nw | |
# gi_mongo-express: | |
# image: mongo-express | |
# container_name: mongo-express | |
# restart: always | |
# env_file: | |
# - ./backend/.env | |
# depends_on: | |
# - gi_mongodb | |
# volumes: | |
# mongo_data: | |
networks: | |
gi_local_nw: | |
external: false |
This file contains hidden or 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
FROM node:22 | |
WORKDIR /app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . | |
ENV NODE_ENV=production | |
ENV NODE_OPTIONS="--max_old_space_size=4096" | |
RUN npm cache clean --force | |
RUN CI=false npm run build | |
EXPOSE 3000 | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment