Example applications with Dockerfiles

Last modified by terala@helsinki_fi on 2024/02/07 06:33

We aim to collect a few example applications (with all the necessary files) for the most commonly used technologies/programming languages on this page. This is to make starting a project in OpenShift a little easier. With time and possibilities permitting, examples of YAML files, Gitlab pipelines etc will be added. Red Hat UBI Images will be used when possible.


How a Dockerfile looks (empty rows do not matter)

FROM Image:version
or
FROM Image:version as application_nimi #nimi to later reference this Image in this Dockerfile

WORKDIR /directory #location for the source code, the Dockerfile is now in the root foler
COPY from to

RUN <command> #command in the terminal, e.g. pip install -r requirements.txt
or
RUN ["example.py", "arg1", "arg2"]

EXPOSE 3000 #the port visible outside the container
CMD ["python", "example.py"]

In order to avoid random crashes/weird behaviour, ALWAYS place the version number in the "FROM Image" part. Image:stable will not guarantee that the Image will stay as the same major version.

Docker documentation regarding syntax.

More info: https://thenewstack.io/docker-basics-how-to-use-dockerfiles/

Images can be found from RedHat or Docker Hub, RedHat UBI Images are recommended because RedHat guarantees that they work on OpenShift. More info about UBI


Python

A simple web-app using Flask, tests and GitLab pipeline configured.

https://version.helsinki.fi/tike-kontit/openshift-esimerkit/python3


Node.js

Java



Contact information

The recommended contact for questions is:

https://helsinkifi.slack.com #kontit 

All changes related to resources for the project/namespace should be emailed to:

grp-openshift-owner@helsinki.fi (platform administration and development)tike-ohjelmistotuotanto@helsinki.fi (program development)