#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Code setup
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Well I think that's enough theory. It's about time to write some code, isn't it? So let's start by configuring our little repository here.
0:08
So here you can see where our final section our days 97 to 100 Docker. What we're going to do is put some code in here.
0:17
So, we are going to need a little bit of structure and we are also going to need some application to run. So, let's do this structure thing first.
0:24
We're going to create a folder called frontend. And I'm going to create a folder called services. So, this is going to be our Vue.js front ends
0:33
our static files and this is going to be the backend services that drive our Vue.js front end. And then we're also going to have something else
0:42
we'll add here in a little bit. So, what we're going to see is each one of these is going to get a Dockerfile but it's also going to need access
0:49
to the source code to run it. Let's go to our previous section here and take these two things and move them around.
0:58
Over here we are going to have movie exploder. And this one we're going to have a movie service. Remember this is a responder application.
1:07
Our little code that we copied over implements our movie service we have over here. It's actually going to run it locally
1:14
in one of our Docker containers. So the idea will be that this front end app is going to serve up the static HTML and Vue.js stuff
1:22
and then it's going to talk to this one back here. Alright, well that's going to get us started for our demo. Let's go ahead and open this in PyCharm.
1:33
And we can configure this out a little bit. Here we go. The source root and resource root. Same for this one. And we can go ahead run this
1:47
actually, we are going to need to install our requirements. But we can go ahead and run this and make sure that it works.
1:52
And it's probably something we'll want to do. But we're going to have this structure like this. It's really helpful because the Dockerfile
2:00
way you build, most easily has access to the stuff under the directory from where it's working so subdirectories and so on.
2:08
So that's how we're going to build our code and that's how we're going to structure it. I'm not super thrilled about the way this works
2:14
but it's probably the best structure I can find for Docker. I did some looking around, what other folks are doing
2:21
and it seems like no one can really agree on what's best. There's always a few little hoops you got to jump through
2:25
because of this subdirectory requirement.