Docker
Docker is a way to build and ship portable containers for running applications.
Containers are typically used in more advanced deployment scenarios, in which coordination with other web services is needed.
Generate the site and a Dockerfile
The m2c2kit CLI can create a simple Dockerfile to demonstrate how the static site can be containerized. To do this, use the --dockerfile
option:
m2 static-site --config=site-config.mjs --dockerfile
This will create a Dockerfile that can serve the static site using NGINX, a popular open-source web server.
Run the image as a container
To build an image from the Dockerfile and serve the site using NGINX on local port 8080, mapping to port 80 in the container:
docker build -t m2c2kit-static-site .
docker run -p 8080:80 m2c2kit-static-site
tip
If you visit the site and it is blank, remember that you must specify the assessment!