-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Workflow #2
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Edit the workflow fileStep 2: Edit the workflow fileWe are going to edit the current workflow file in our repository by adding adding a job that turns our ⌨️ Activity: Edit the workflow file and turn the Dockerfile into a Docker Image
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
Complete cd-workflow.yml file...name: Docker CD
on:
push:
# branches-ignore:
# - "ci-workflow"
# - "docker-workflow"
paths:
- "**Dockerfile**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: npm install and build webpack
run: |
npm install
npm run build
- uses: actions/upload-artifact@master
with:
name: webpack artifacts
path: public/
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
os: [ubuntu-lastest, windows-2016]
node-version: [10, 12]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/download-artifact@master
with:
name: webpack artifacts
path: public
- name: npm install, and test
run: |
npm install
npm test
env:
CI: true
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 |
Merged
Great Job 👍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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.