In this chapter, you will learn how the Minimal Stage 2 Docker image is built. Note that much of the contents of this repository are the same as those of the repository studied in the previous chapter. The differences will be highlighted here.
- variables.sh Script
- usr_local_bin Directory
- Building the Docker Image Locally
Go to https://gitlab.com/rubyonracetracks/docker-debian-buster-min-stage2. This is the repository used for building the Minimal Stage 2 Docker image.
The only difference here is that the ABBREV variable is now "min-stage2" instead of "min-stage1".
- The Docker image built from the processes in the previous chapter is used as the basis for building this chapter's new Docker image.
- Note that the "RUN" step is executed as the user "winner", which means that "sudo" must be used for making all files in the /usr/local/bin directory executable and for running the min-stage2-root script.
- The min-stage2-root script executes the root actions needed to build the new Docker image. These include updating apt-get (through the aptget script), installing basic development tools with apt-get, installing Heroku, and installing PostgreSQL.
- The min-stage2-root script also calls the min-stage2-user1 script, the min-stage2-user2 script, and the /usr/local/bin/check script.
- The min-stage2-user1 script installs NVM (Node Version Manager).
- The min-stage2-user2 script installs Node and Yarn. Installing NVM and Node in the same script didn't work out for me, so I had to split these steps into two different scripts.
- The min-stage2-check script (which is called by the /usr/local/bin/check script) displays the versions of Heroku, Python, NVM, Node, NPM, Yarn, SQLite, PostgreSQL, and other software installed.
Building the Docker Image Locally
- Enter the following commands:
cd cd rubyonracetracks git clone https://gitlab.com/rubyonracetracks/docker-debian-buster-min-stage2.git cd docker-debian-buster-min-stage2 bash build.sh
- The screen output is automatically logged. The log files are in the log directory.
- After several minutes, the build process will be finished.