npm install -g @angular/clior if you use Yarn, run
yarn global add @angular/cli.
ng newcommand to create a new Angular 9 project. Make sure you answer all the questions you get in the terminal because this is going to make the setup very easy.
ng new project-name
ng new project-name --packageManager=yarn
docker -version. If you see a version number, everything is good to go to the next step.
Dockerfile, notice there is no file extension. (That's correct.)
/opt/ngso we know the directory where everything will be copied to with the
yarncommand as you would do on your local computer.
npm installcommand to install all the dependencies.
ng build --prod. It is recommended to run this command on your computer before creating a Docker image, this will save you from constantly building a Docker image that is failing.
FROMstatement where we specify we want to use
COPYstatement copies the
default.conffile from the
nginxbase image to the Docker image we are building.
COPYstatement tells it that we want some files from the
compile-image. So, underwater, it has built the first part of the image in a separate Docker image.
node_modulesfolder. We only use the files of our application. This will save some bytes on the Docker image.
Dockerimagefile. We are ready to run the command to build our image.
docker container ls.) You don't need the long ID, just type the first three or four characters, that will be enough.
docker runcommand above.
USERNAMEwith your username and
TOKENwith the token you have created via the GitHub website. Give the token a name and select the repo,
IMAGE_IDwith your image ID. Next, replace everything in the URL with your information. For
VERSION, you can start with
0.0.1or anything else that makes sense for you.