Technologies
# Preparation
Copy the following files into a local directory on your system.
app.mjs
helpers.mjs
package.json
Dockerfile
# Build the image
Open a CLI and navigate into the folder you copied the files to.
Run:
The output will give you a container Id. Something like
# Run the container based on the image
Use the first few characters of the ID (copy enough so that it is unique) to run a container based on that image.
You can then open the app on port 3000 of your local machine.
# Try using different ports
Specify different ports for both the exposed container port aswell as the host port.
# Make a change
Change the HTML output from the web server to something else. Run the container again and make sure you see the changes.
- Here you also have to rebuild the container
# Optimize the Dockerfile
Make sure that npm install
only executes when the package.json file changes.