Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

ObjectifLibre/openshift-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenShift Docker

This repository contains the docker image sources used in FUN's new OpenShift-based infrastructure to run Open-edX, DjangoCMS and other applications.

Usage

Build a service image

Building a service Docker image can be achieved thanks to the bin/build utility script, e.g.:

$ bin/build nginx

For a target service, the build script expects a Dockerfile and context to be located in a docker/images/<service>/ directory, e.g.:

.
├── ...
├── docker
│   └── images
│       └── nginx
│           └── Dockerfile
└── ...

The target build image will be automatically tagged with the following pattern:

fundocker/openshift-<service>:<version>

with <service> the service name (e.g. nginx) and <version> the version tag of the original service image (e.g. 1.13) extracted from the first FROM statement of the service's Dockerfile, e.g.:

# docker/images/nginx/Dockerfile
FROM nginx:1.13

# ...

Once the build succeeds, you can check image availability via:

$ docker images "fundocker/openshift*"
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
fundocker/openshift-nginx   1.12                97fa5695dab6        22 hours ago        108MB
fundocker/openshift-nginx   1.13                367a1bb94e8a        23 hours ago        109MB

Publish a service image

Once built, you can publish your image to DockerHub via the bin/publish script, e.g.:

$ bin/publish nginx

The script will automatically look up for a built image tagged with the pattern described in the previous section and will push this new image to the DockerHub public repository.

You will need to create a DockerHub account first and log in via the docker login command.

Continuous Integration and Delivery

To make sure our release process is reproducible, we have automated image build and publication using CircleCI.

Our building strategy follows:

  1. All services are constantly built when a new pull request is proposed and the related branch is merged to master.
  2. We publish a new image to DockerHub when the git repository is tagged with a tag matching the following pattern: <service>-<version>, e.g. nginx-1.13.
  3. We publish all images to DocherHub when the git repository is tagged with a tag matching the following pattern: all-<date>, e.g. all-20180423.

Adding a new service

To add a new service foo, create the service directory first:

$ mkdir docker/images/foo

Then write OpenShift compatibility statements that will add new Docker layers over the base image (see OpenShift's documentation to get official guidelines):

# docker/images/foo/Dockerfile
FROM foo:2.4.12

# Allow foo to be started by a non privileged user
RUN chgrp -R 0 /var/run/foo

Remarks

  • Always derive your Dockerfile from an official image and make sure it is still maintained.
  • When building an image, the building context is the docker/images/<service> directory, so if you need to add files to the context (e.g. for a COPY statement), make sure to place them in this directory.

Publish your image using the CI

Once your image is ready to be published, you are invited to:

  1. Update the list of available images in the next section of this document.
  2. Push your feature-branch (you've created a feature branch, right?) to GitHub and open a new pull request (PR).
  3. Look for CI status and wait for a review of your work. If everything went well, proceed to the next step.
  4. Create a new repository on DockerHub under the fundocker organization umbrella (it should be named following our image tagging pattern - see above), and give the bot team write access to this repository.
  5. Tag the repository (see building strategy in the CI/CD section) to publish your image:
$ git tag nginx-1.13
$ git push origin --tags
  1. Merge your PR.

Available images

We maintain a restricted set of OpenShift-compatible images we use in production. An exhaustive list of those Docker images follows:

nginx

License

This work is released under the MIT License (see LICENSE).

About

🐋 OpenShift-compatible Docker images used at FUN

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%