docker-compose.test.yml
version: '2'
services:
express-mongoose-es6-rest-api:
build:
context: .
image: express-mongoose-es6-rest-api:latest
volumes:
# Mounts the project directory on the host to /app inside the container,
# allowing you to modify the code without having to rebuild the image.
- .:/app
# Just specify a path and let the Engine create a volume.
# Data present in the base image at the specified mount point will be copied
# over to the new volume upon volume initialization.
# node_modules from this new volume will be used and not from your local dev env.
- /app/node_modules/
# Set environment variables from this file
env_file:
- .env
# Overwrite any env var defined in .env file (if required)
environment:
- MONGO_HOST=mongodb://mongo/express-mongoose-es6-rest-api-test
- DEBUG=express-mongoose-es6-rest-api:*
# Link to containers in another service.
# Links also express dependency between services in the same way as depends_on,
# so they determine the order of service startup.
links:
- mongo
command:
- /bin/bash
- -c
- yarn --pure-lockfile && yarn test
mongo:
image: "mongo:3.4.2"
ports:
- "27017:27017"