Automatic Builds with GitHub Actions#

GitHub will build Docker containers for you. The resulting built container is available on GitHub’s public repository, which simplifies deployments.

Enable Actions for a Repository#

Actions are enabled when you place YAML files in the .github/workflows directory in the repository. Follow the instructions in GitHub’s Publishing images to GitHub Packages documentation.

Important

The example action in the documentation uses the branch release, you should change it to main.

Check In a Dockerfile#

Use the Dockerfile from the last lab. Commit it in the root of your CIS-92 repository and push the commit.

Watch and Run#

After you push your Dockerfile go to GitHub and watch the action. Make sure it completes successfully. Once it does you will be able to use the image that was built:

$ docker run -it --rm -p 8080:8080 ghcr.io/your-name/repo-name:latest