Usage Scenario
Build a docker image and push to Docker hub
How to Set Up
We demonstrate the setup with a tutorial project. It is a react project created with npx create-react-app
. In this project:
- A simple dockerfile is added to serve build result with Nginx
- A CI job is added in the build spec to build and publish the docker image. In this job:
- the
checkout
step clones he repository into job workspace - the
build
step tests and creates production build - the
publish docker image
step builds and publishes the docker image
- This job should be executed by a docker aware executor (server docker executor, remote docker executor, or kubernetes executor), with the mount docker sock option enabled like below:
- You may also use the built-in build docker image step to do the job. In that case, you will need to specify docker registry login in job executor setting