Docker
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)."Afterward, you can make it executable by running
chmod +x quickstart.shin 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.yamlfile with the following content:tasks: build-image: steps: - checkout - docker/build: image: quay.io/docker/quickstart ## Name of docker image with registry push: trueThis config instructs Razorops to perform tasks based on your specifications. You can find more information about how we build docker images on this page.
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.