Skip to content

Instantly share code, notes, and snippets.

@KrishnaPravin
Last active March 23, 2021 07:56
Show Gist options
  • Save KrishnaPravin/2982a48b79d89bb85f98ef0d7c331ef9 to your computer and use it in GitHub Desktop.
Save KrishnaPravin/2982a48b79d89bb85f98ef0d7c331ef9 to your computer and use it in GitHub Desktop.
Docker File NPM run build from environment variable
# Docker version 20.10.5, build 55c4c88
# Default argument
docker build . --progress plain --no-cache
# Passed argument
docker build . --progress plain --no-cache --build-arg APP_ENV=prod
FROM node:alpine
COPY . .
ARG APP_ENV=dev
RUN npm run build:$APP_ENV
{
"name": "docker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build:dev": "echo \"hello KKKKKKKKKKKKKKKKKKKKK\"",
"build:prod": "echo \"hello AAAAAAAAAAAAAAAAAAAAAA\""
},
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment