Dockerfile with one single line
Then build the image using the command
$ docker build -t my-private-blog .
Now run with the following command
$ docker run -d -p 8000:80 -v c:/Workspace/Non-Obex/my-private-blog/_site:/usr/share/nginx/html my-private-blog
Let's explain each of the option:
8000is the port of the host machine. So later we will point the browser to http://localhost:8000
80is the port that
c:/.../_siteis the folder where
Eleventygenerates the static
/usr/share/nginx/htmlis the directory where
nginxlooks for the index file.
If we need to run
sh shell, run the command
$ docker ps
then look for the name of the container in the output. It's usually 2 random words concat by an underscore. For example it might be something like
$ docker exec -it hungry_shamir /bin/sh
The nice thing is as we write more posts, all we have to do is running the command
eleventy. The refresh the browser. The new posts will be reflected automatically.