Improve docker for local server

This commit is contained in:
Adolfo Reyna
2025-02-21 00:12:42 -05:00
parent 1056a91c33
commit 66893f7e53
2 changed files with 24 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
# Use an official Node.js runtime as a parent image # Use an official Node.js runtime as a parent image
FROM node:18-alpine FROM node:22-alpine
# Install Python, make, and g++ to allow native module compilation # Install Python, make, and g++ to allow native module compilation
RUN apk add --no-cache python3 make g++ RUN apk add --no-cache python3 make g++

View File

@@ -6,33 +6,38 @@ networks:
services: services:
app: app:
restart: always
build: build:
context: . context: .
ports: ports:
- '3001:3001' - '3001:3001'
environment: environment:
- MONGO_URL=mongodb://mongo:27017/testdb - MONGO_URL=${MONGO_URL}
- PUBLIC_VAPID_KEY=${PUBLIC_VAPID_KEY}
- PRIVATE_VAPID_KEY=${PRIVATE_VAPID_KEY}
- WEB_PUSH_EMAIL=${WEB_PUSH_EMAIL}
- EMAILPASS=${EMAILPASS}
- PORT=3001 - PORT=3001
volumes: volumes:
- .:/app - .:/app
- '/app/node_modules' - '/app/node_modules'
depends_on: #depends_on:
- mongo # - mongo
command: nodemon command: node index.js
networks: # networks:
- emi-network # - emi-network
mongo: #mongo:
image: mongo:latest # image: mongo:latest
ports: # ports:
- '27017:27017' # - '27017:27017'
networks: # networks:
- emi-network # - emi-network
volumes: # volumes:
- mongodbdata:/data/db # - mongodbdata:/data/db
- ./dump:/dump # - ./dump:/dump
#entrypoint: mongodump ${MONGO_URL} && mongorestore --db EMI_SOCIAL dump/EMI_SOCIAL/ && mongod #entrypoint: mongodump ${MONGO_URL} && mongorestore --db EMI_SOCIAL dump/EMI_SOCIAL/ && mongod
volumes: #volumes:
mongodbdata: #mongodbdata:
driver: local # This ensures the volume is created # driver: local # This ensures the volume is created