Skip to content

Instantly share code, notes, and snippets.

@qwexvf
Created September 19, 2018 12:15
Show Gist options
  • Save qwexvf/26e623f070d70660298a37664130d47c to your computer and use it in GitHub Desktop.
Save qwexvf/26e623f070d70660298a37664130d47c to your computer and use it in GitHub Desktop.
Simple docker-compose for nodejs project
version: '3.2'
services:
datastore:
image: busybox
volumes:
- db_data:/var/lib/psql
db:
image: postgres:10.1
volumes:
- db_data:/var/lib/psql
environment:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
front:
build:
context: .
dockerfile: ./docker/node/Dockerfile
tty: true
stdin_open: true
command: "npm run dev"
volumes:
- yarn_install:/app/node_modules
- ./:/app
ports:
- '8080:8080'
depends_on:
- db
links:
- db
volumes:
db_data:
yarn_install:
# create a folder called docker and insode create another folder called node then put this file in there.
# note: change the node version the your preferred one.
FROM node:10
WORKDIR /app
# you may also want to change the location of package.json
COPY . /app/
RUN npm i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment