Creating a basic Docker build workflow

Let's perform the following steps to automate the Docker image build directly from our GitHub repository:

  1. Sign in to your GitHub account.
  2. Select a repository where you have maintainer access. In our example, we are using the fork of the k8sdevopscookbook/python-flask-docker project.
  3. Click the Actionstab.
  4. From here, click on Add a new workflow.
  5. Create a dockerimage.yml file under the .github/workflows directory with the following content:
name: Docker Image CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

The workflow will create a new Docker image every time new code is pushed to the repository.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.60.249