Skip to content

Instantly share code, notes, and snippets.

@aspen-roller
Created December 3, 2020 18:53
Show Gist options
  • Save aspen-roller/3517cd3e85ab2edb86b2f37fef7cd9cc to your computer and use it in GitHub Desktop.
Save aspen-roller/3517cd3e85ab2edb86b2f37fef7cd9cc to your computer and use it in GitHub Desktop.
Node.js docker-compose #nodejs #docker
# Assumptions
# node_modules installed under /opt
# application installed under /opt/app
# Simple Build Commands
docker image build -t ultimate:dev --target dev .
docker image build -t ultimate:test --target test . # update below for MICROSCANNER
docker image build -t ultimate:prod --target prod .
# MUST pass ARGs as --build-arg
# TOKEN stored as environment variable
docker image build -t ultimate:test --target test --build-arg=MICROSCANNER_TOKEN=$MICROSCANNER_TOKEN .
# Handle non-graceful node.js shutdowns to run images
docker run --init ultimate:test
docker run --init ultimate:prod
docker run --init -v $(pwd):/opt/app ultimate:dev
docker-compose up # alternative to above, compose file targets local build for the "dev" stage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment