Skip to content

Add docker image push to ci

What does this MR do?

This MR adds the configuration for pushing docker images to a container registry. By default the CI script will publish those images at the gitlab container registry, that can be changed using environmental variables.

I created the release stage and added three jobs to it.

  • docker:next This job is meant to run at every merge to master and produces the universis-students:next image
  • docker:latest This job is meant to create the image with the latest stable release.
  • docker:version This job is meant to create an image for any version of the project

The project version is being read from the package.json file at the project root

Configuration

You can select to what registry the images will be published by overriding the default gitlab ci variables. For instance those variables are

  • CI_REGISTRY The url of the target registry
  • CI_REGISTRY_USER The username of the account at the docker registry
  • CI_REGISTRY_PASSWORD The password (or auth token) of the account at the docker registry
  • CI_REGISTRY_IMAGE The image to be published

In case that you want to use these variables to a branch other than main/master, you have to not make them protected or make protected the target branch.

Example for docker hub

This is the configuration one can use in order to publish images to the docker hub. I will use my own account as an example.

  • CI_REGISTRY=docker.io
  • CI_REGISTRY_USER=dpliakos
  • CI_REGISTRY_PASSWORD=<auth_token> (I suggest you to create an authentication token instead of using your own password)
  • CI_REGISTRY_IMAGE=docker.io/dpliakos/universis-students

Related issues and links

Fix

Other relevant links

Developer Checklist

  • I have successfully run the code of this merge request locally

  • I have verified locally that my changes work for all necessary screen sizes

  • I have tried out the changes of this MR with different users to identify bugs

  • Coding is in progress, and I have marked the MR as WIP

  • Coding is completed and the MR is ready for review

  • My branch is up-to-date with the upstream master branch

  • My MR follows the contribution guidelines

  • I have added a comment with screenshots of the code running locally

Tech review Checklist

Have you verified that what is supposed to happen, actually does, and what is not supposed to happen, indeed does not?

  • The MR accurately describes the changes and has a relevant title/description
  • The MR does what it is supposed to according to its title, description and related issues/links
  • I have successfully run the changes locally, and tried the new code

Overall review Checklist

  • The MR references related issues/MRs
  • The MR provides links to screens and screenshots
  • The commits of the MR describe the changes, have proper wording, and follow the guidelines
  • I have successfully run the changes locally, and tried the new code
  • The MR is ready for merge (rebased, commit squashed if needed, etc)
Edited by Dimitrios Pliakos

Merge request reports