Skip to content

Instantly share code, notes, and snippets.

@primayudantra
Created May 18, 2020 11:52
Show Gist options
  • Save primayudantra/78071786abf8f503817c589e77ed39b1 to your computer and use it in GitHub Desktop.
Save primayudantra/78071786abf8f503817c589e77ed39b1 to your computer and use it in GitHub Desktop.
node-docker
redis:
image: redis
container_name: cache_service
expose:
- 6379
app:
build: ./
volumes:
- ./:/var/www/app
- .env.docker:/var/www/app/.env
environment:
- REDIS_URL=redis://jobkred_mailer_cache
links:
- redis
ports:
- 4000:4000
FROM node:12
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
RUN npm install pm2 -g
# If you are building your code for production
RUN npm ci --only=production
# Bundle app source
COPY . .
EXPOSE 4000
CMD ["pm2-runtime", "start", "index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment