Complete the code to specify the Docker image to use in the GitHub Actions workflow.
jobs:
build:
runs-on: ubuntu-latest
container:
image: [1]The container.image field specifies the Docker image to run the job in. Here, node:14 is a valid Docker image.
Complete the code to check out the repository in a GitHub Actions workflow step.
- name: Checkout code
uses: [1]The actions/checkout@v3 action checks out your repository code so the workflow can access it.
Fix the error in the step to build and push a Docker image using the official GitHub Action.
- name: Build and push Docker image uses: docker/build-push-action@v3 with: context: . push: [1]
The push input expects a boolean value true or false. Here, true enables pushing the image.
Fill both blanks to set environment variables for Docker Hub username and password in the workflow step.
- name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.[1] }} password: ${{ secrets.[2] }}
You store your Docker Hub username and password as secrets named DOCKER_USERNAME and DOCKER_PASSWORD. These are referenced here.
Fill all three blanks to build a Docker image with a tag and push it using the GitHub Actions Docker build-push action.
- name: Build and push Docker image uses: docker/build-push-action@v3 with: context: [1] push: [2] tags: [3]
The context is the build folder, usually .. push must be true to push the image. tags is the image name and tag.