#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Concept: Dockerfile for the static site

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's review the Dockerfile. In this case, we're going to look at the one we used for the front ends for serving static content through Nginx.
0:07 So the Dockerfile always starts with from some image, maybe some tag. So from, Ubuntu, and the tag is 18.04. So that's how we start.
0:18 Now, pretty much always you're going to want to update your Linux. You saw that the latest version was on DockerHub already detected vulnerabilities.
0:29 You want to start from the best place you can so make sure you run apt update and then apt upgrade. So apt update gets a fresh list of changes
0:40 for all the installed packages and then apt upgrade actually does the upgrade. We installed a couple of little helper utilities.
0:47 As you saw, I'm a fan of htpy and Glances, things like that. So we're going to install those and then we're going to begin installing the stuff
0:55 that we actually need to run our code. So we're going to install Nginx on this one. That's going to be our web server.
1:02 We also want to make a change to the host file on this particular machine. So we're going to have a local host file
1:07 that's going to overwrite the one over there. So we're going to use this copy command. Here we're copying a single file, host.txt
1:14 to rename it to /etc/host and replace that file. Then we're going to remove the default Nginx file so that we don't just get, like, welcome to Nginx
1:24 but, in fact, you get just our site. We configure Nginx by having an Nginx config file and putting it in this location.
1:32 So we're going to do a copy, get our local one move it over there. Then we need to copy all of our code
1:37 our Vue.js code, our JavaScript, our CSS, our images. So we do that by copying this directory to /app. Now this container is ready to run.
1:47 We're going to add an entry point here at the end to say, well, if you just run it without any command you're going to run Nginx -g daemon off.
1:57 As long as Nginx is running, the container is running; as soon as it stops, the container stops. So, that's how we get our site set up and ready to go
2:05 for Docker serving static content.

Talk Python's Mastodon Michael Kennedy's Mastodon