GitHub Deployment#

This week you created a Dockerfile to package your application and a GitHub action to automatically build your container. To complete this milestone you have to prove that your public container is ready to run. I will pull your container image and test it.

The Embedded Database#

So far you’ve been building a container with a file called mysite/db.sqlite3. This file contains the user database (and any other runtime data for Django). For now this has made things easy for us, but it means that the admin user and password are effectively embedded into the container image, which is a security vulnerability. As we get ready for this container to go into production you should think about what kind of data you have and were it belongs. Start asking:

  • How do I configure my container and load my source code?

  • How do I tell the container what TCP port to use?

  • Where is the user data in my application stored?

These will be important when we start relocating parts of the container. For this milestone you should initialize the database with the following defaults:

  • Admin username: student

  • Admin email: student@cis.cabrillo.edu

  • Admin password: Cabri11o (a.k.a “funny Cabrillo”)

I will check that these are set properly.

Test Procedure#

I will use the command you give me to ensure that your built container image exists and I will run it on my computer to be sure that everything is correct. Ensure your built container works using this procedure:

  1. Pull and run your Docker image using the URL you submit:

    $ docker run -it --rm -p 8000:8000 ghcr.io/your-user-name/your-repo-name:milestone-3.x
    
  2. Login to your application using the credentials above.

Warning

If I can’t login using the student and Cabrillo credentials I will return this milestone to you.

Release#

Before you submit this milestone make a GitHub release named milestone-3.x. When you created the GitHub action you added a trigger that should build your Dockerfile automatically when a release is created. After you create the release verify that the container builds. The container should also be tagged with the release name. I will use the release name when I pull your image.

Turn In#

  1. Tag this milestone milestone-3.x.

  2. A docker pull command that gets your built container from GitHub’s repo. You can find this by clicking your built container under “Packages” in GitHub. The command should look like this:

$ docker pull ghcr.io/your-user-name/your-repo-name:milestone-3.x