Skip to content

Running Nodal with Docker locally

Michael Mior edited this page Feb 22, 2016 · 2 revisions

Add a Dockerfile to build a container for the Nodal app.

FROM node
EXPOSE 3000

RUN npm install -g --silent nodal

WORKDIR /usr/src/app
CMD ["npm", "start"]

Add docker-compose.yml to define the service configuration.

web:
  build: .
  ports:
   - "3000:3000"
  volumes:
   - .:/usr/src/app
  links:
   - db
  environment:
   - DATABASE_HOST=db
   - DATABASE_PORT=5432
   - DATABASE_USER=nodal
   - DATABASE_PASSWORD=nodal
   - DATABASE_DB=nodal_development
db:
  image: postgres
  environment:
   - POSTGRES_USER=nodal
   - POSTGRES_PASSWORD=nodal
   - POSTGRES_DB=nodal_development

Update your configuration in any environments you want to use with Docker to make use of the environment variables.

"adapter": "postgres",
"host": "{{= env.DATABASE_HOST }}",
"port": "{{= env.DATABASE_PORT }}",
"user": "{{= env.DATABASE_USER }}",
"password": "{{= env.DATABASE_PASSWORD }}",
"database": "{{= env.DATABASE_DB }}"