We have an angular/express app that is dockerized and deployed in k8s.
Dockerfile:
FROM node:18
WORKDIR /usr/src/app
COPY . .
EXPOSE 1234
CMD [ "npm", "run", "prod" ]
Is it possible to have a variable and have that variable be dynamic?
Example of what I want:
FROM node:18
WORKDIR /usr/src/app
COPY . .
EXPOSE 1234
CMD [ "npm", "run", ENV ] <<<<<------ HERE (want to pass in either dev or prod)
I have a build script (which needs to be run with an arg passed in) that does the following:
- ./build_and_deploy_app.sh dev or ./build_and_deploy_app.sh prod
dev or prod are the variables I want to pass into Dockerfile
builds docker app
tags docker app
pushes docker app to ECR
Once that docker image is pushed to ECR:
- We update our k8s deployment to use the newly uploaded image
I wondering if there is a way to allow our Dockerfile (docker image that is uploaded to ECR) to use a dynamic variable instead of a static variable (like shown above).
Thank you!