Skip to content

Instantly share code, notes, and snippets.

@joduplessis
Created August 29, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joduplessis/96e1ff998ea4bd865a6427aeab48428a to your computer and use it in GitHub Desktop.
Save joduplessis/96e1ff998ea4bd865a6427aeab48428a to your computer and use it in GitHub Desktop.
Docker files for a Nodejs websocket service using Redis.
version: "3"
services:
redis:
image: redis
container_name: redis
ports:
- 6379:6379
expose:
- 6379
websocket:
build:
context: ./
dockerfile: ./Dockerfile.development
depends_on:
- redis
container_name: websocket
volumes:
- ./:/var/www/websocket
links:
- redis
env_file:
- .env
ports:
- 3333:3333
command:
sh -c 'npm i && npm run start'
version: "3"
services:
websocket:
build:
context: ./
dockerfile: ./Dockerfile.production
container_name: websocket
working_dir: /var/www/websocket
environment:
- REDIS_HOST: ${REDIS_HOST}
- REDIS_PORT: ${REDIS_PORT}
- PORT: ${PORT}
ports:
- 3333:3333
command:
sh -c 'npm i && npm run start'
FROM node:10
MAINTAINER Jo du Plessis <jo@joduplessis.com>
WORKDIR /var/www/websocket
FROM node:10
MAINTAINER Jo du Plessis <jo@joduplessis.com>
WORKDIR /var/www/websocket
COPY . /var/www/websocket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment