0.1.0 • Published 7 years ago

docker-env-version v0.1.0

Weekly downloads
9
License
ISC
Repository
github
Last release
7 years ago

docker-env-version

NPM version hook to update Docker .env file with package version (for use in tagging Docker images, for example).

INSTALLATION

npm i --save-dev docker-env-version

USAGE

In package.json (shown with optional path to Docker .env file--default is ./.env):

"name": "my-npm-app",
"scripts": {
  "version": "docker-env-version ../.env"
}

And in docker-compose.yaml (note that environment variable is uppercase PACKAGENAME_VERSION and all nonalphanumeric characters in PACKAGENAME will be replaced with underscore):

version: '2'

services:
  myapp:
    build:
      context: myapp/
    image: "myapp:${MY_NPM_APP_VERSION}"

Project directory structure for this example looks like:

myapp/
  dist/
  src/
  Dockerfile
  package.json
docker-compose.yaml
.env

...and in such an example, docker-env-version should be installed in myapp, not in root Docker project (that might not be true in your case).

0.1.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago