Closed github-learning-lab[bot] closed 4 years ago
We are going to edit the current workflow file in our repository by adding adding a job that turns our Dockerfile
into a Docker Image
.
ci-workflow.yml
to cd-workflow.yml
:Node CI
to Docker CD
name: Docker CD
Build-and-Push-Docker-Image:
runs-on: ubuntu-latest
needs: test
name: Docker Build, Tag, Push
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Download built artifact
uses: actions/download-artifact@master
with:
name: webpack artifacts
path: public
- name: Build, Tag, Push
uses: mattdavis0351/actions/docker-gpr@v1.3.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
image-name: tic-tac-toe
I have merged this pull request for you, and opened a new one for you to start working on the CD segment of our workflow.
Navigate to the next pull request to continue this course.
Docker 🐳
What is Docker?
Docker is an engine that allows you to run containers. Containers have many advantages, including:
Docker vs Virtual Machines
Dockerfiles, Images, and Container
Before moving forward with the workflow file, let's spend some time on these concepts. There are important differences between Dockerfiles, Images, and Containers.
What about our workflow?
Our repository contains a
Dockerfile
, source code, and tests for the Tic Tac Toe application.Our CI Workflow allows us to make code changes. Those changes will trigger an automated build and automated test. But, the automation does not create a deployable artifact.
We will place our application into a Docker container. Then, we will have a deployable package. A deployable package enables CD.
Because a
Dockerfile
is a text file, we are able to version it as source code. This configuration as code allowing us a single point of truth for our application.As you learned above, we need turn that Dockerfile into a Docker image if we want to create a runtime instance. We are going to store that image in GitHub Packages.
📖Read More about Docker.