Skip to content

Instantly share code, notes, and snippets.

@aluissp
Last active March 5, 2023 00:19
Show Gist options
  • Save aluissp/f32dc0155bedd20dc50d66762e82de15 to your computer and use it in GitHub Desktop.
Save aluissp/f32dc0155bedd20dc50d66762e82de15 to your computer and use it in GitHub Desktop.
Simple config to Dockerfile and docker-compose.yml
version: "3.9"
services:
animals-app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
links:
- animals-db
volumes:
- .:/home/app
animals-db:
image: mongo
ports:
- "3005:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=luis
- MONGO_INITDB_ROOT_PASSWORD=2002
volumes:
- mongo-data:/data/db
# mysql => /var/lib/mysql
# postgres => /var/lib/postgresql/data
volumes:
mongo-data:
version: "3.9"
services:
animals-app:
build: .
ports:
- "3000:3000"
links:
- animals-db
animals-db:
image: mongo
ports:
- "3005:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=luis
- MONGO_INITDB_ROOT_PASSWORD=2002
volumes:
- mongo-data:/data/db
# mysql => /var/lib/mysql
# postgres => /var/lib/postgresql/data
volumes:
mongo-data:
FROM node:18
RUN mkdir -p /home/app
COPY . /home/app
EXPOSE 3000
CMD ["node", "/home/app/index.js" ]
FROM node:18
RUN npm i -g nodemon
RUN mkdir -p /home/app
WORKDIR /home/app
EXPOSE 3000
CMD ["nodemon", "index.js" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment