Skip to content

Instantly share code, notes, and snippets.

@davepoon
Created July 17, 2017 13:03
Show Gist options
  • Save davepoon/c75694283490447d83df2adcfb12ccc6 to your computer and use it in GitHub Desktop.
Save davepoon/c75694283490447d83df2adcfb12ccc6 to your computer and use it in GitHub Desktop.
loopback and mysql docker-compose.yml
# The standard now
version: '2'
# All of the images/containers compose will deal with
services:
# our strongloop service shall be known as 'api'
api:
# use your user name
image: davepoon/strongloop-dev
# map the containers port of 3000 to our local 3002
ports:
- 3002:3000
# mount our current directory (code) to the container's /usr/src/api
volumes:
- .:/usr/src/api
# the default command unless we pass it one
command: nodemon .
# ADD HERE. This is what our MySQL service shall be known as
mysqlDb:
# This is the official MySQL 5.6 docker image
image: mysql:5.6
# These are required variables for the official MySQL image
environment:
MYSQL_ROOT_PASSWORD: "${DB_ROOT}"
MYSQL_DATABASE: "${DB_NAME}"
MYSQL_USER: "${DB_USER}"
MYSQL_PASSWORD: "${DB_PWD}"
# Keep it mapped to the usual MySQL port
ports:
- 3306:3306
# Create a separate volume on our machine to map to the container's default mysql data directory
volumes:
- strongloopDev:/var/lib/mysql
# These must be declared to be used above
volumes:
strongloopDev:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment