This guide explains how to use Razorops to build a Docker image and push the image to Docker Registry. You need to add Dockerfile and add build configuration file to automate the process.
Preparing source files
You'll need some sample source code to build. In this section, you'll create a simple Hello World example and a Dockerfile.
- Create a file named
quickstart.shwith the following content:
#!/bin/sh
echo "Hello, world! The time is $(date)."
Afterwards, you can make it executable by running chmod +x quickstart.sh in the shell.
- Create a file named Dockerfile with the following contents:
FROM alpine
COPY quickstart.sh /
CMD ["/quickstart.sh"]
- Write Razorops YAML file
In the same directory that contains above files, create .razorops.yaml file with the following content:
tasks:
build-image:
image: quay.io/docker/quickstart ## Name of docker image with registry
push: true
This config instructs Razorops to perform tasks based on your specifications.
- Commit changes
Now add Dockerfile, quickstart.sh and .razorops.yaml into git and push a commit to your Git provider, and you should be able to see a new workflow which builds you docker image and finally push to quay.io Docker registry.