Created
September 19, 2018 12:15
-
-
Save qwexvf/26e623f070d70660298a37664130d47c to your computer and use it in GitHub Desktop.
Simple docker-compose for nodejs project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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