Last active
March 23, 2021 07:56
-
-
Save KrishnaPravin/2982a48b79d89bb85f98ef0d7c331ef9 to your computer and use it in GitHub Desktop.
Docker File NPM run build from environment variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:alpine | |
COPY . . | |
ARG APP_ENV=dev | |
RUN npm run build:$APP_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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