diff --git a/docker-plain/files/README.md b/docker-plain/files/README.md index feb272fe8..0738cd4c5 100644 --- a/docker-plain/files/README.md +++ b/docker-plain/files/README.md @@ -1,5 +1,46 @@ # Plain Docker image (docker-plain) +## Purpose + +This Quickstarter serves as a minimal starting point for building your own components that don't fit any of the other Quickstarters. +For demonstration purposes, a nginx webserver provides a simple 'Hello World' message. + +## Folder structure and important files + +- docker: All files inside this folder are available for use in building the docker container + - [docker/Dockerfile](docker/Dockerfile): Defines the container to be built. +- chart: The Helm chart used for deploying the component. + - [chart/Chart.yaml](chart/Chart.yaml): Metadata for your Helm chart. + - [chart/values.yaml](chart/values.yaml): Default values used when templating the Helm chart. + - [chart/values.dev.yaml](chart/values.dev.yaml): Values used for deployment in the 'dev' environment. Values specified in this file are overriding default values from [chart/values.yaml](chart/values.yaml). + - chart/templates: + - [chart/templates/deployment.yaml](chart/templates/deployment.yaml): Template for the [deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) resource. This is where you add additional configuration like environment variables. + - [chart/templates/service.yaml](chart/templates/service.yaml): Template for the [service](https://kubernetes.io/docs/concepts/services-networking/service/) resource. + - [chart/templates/ingress.yaml](chart/templates/ingress.yaml): Template for the [ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) resource. + +## Testing locally + +If you want to run this component locally for testing, this might get you started. +It also mimicks what's happening in the [Jenkinsfile](Jenkinsfile). + +### Building the container + +Using a local container runtime you can build the container and tag it with the current git revision: + +```bash +docker build -t testing/my-component:$(git rev-parse --short=8 HEAD) docker/ +``` + +### Deploying the helm chart using + +Using a local kubernetes cluster you can deploy the component: + +```bash +kubectl create ns docker-plain +kind load docker-image testing/my-component:$(git rev-parse --short=8 HEAD) +helm upgrade --install --wait --atomic --namespace docker-plain --set image.path=testing --set image.name=my-component --set image.tag=$(git rev-parse --short=8 HEAD) docker-plain chart +``` + ## How to create a custom jenkins-agent out of this docker-plain component - Remove `odsComponentStageRolloutOpenShiftDeployment(context)` from your `Jenkinsfile`. We only want to build a docker image, not run it outside the pipeline. - In your `Dockerfile`, replace `FROM alpine:latest` with the ods-jenkins-agent-base image that is available in the OpenDevStack namespace of your cluster, e.g. `FROM docker-registry.default.svc:5000/ods/jenkins-agent-base:latest`. diff --git a/docker-plain/files/chart/values.yaml b/docker-plain/files/chart/values.yaml index 5eef5c249..10962f07a 100644 --- a/docker-plain/files/chart/values.yaml +++ b/docker-plain/files/chart/values.yaml @@ -14,12 +14,12 @@ fullnameOverride: "" # NOTE: By default image Values are injected from CICD Jenkins pipeline, values defined here are used when not being on CICD Jenkins pipeline context. # Default values here are provided in case one needs to use the chart without CICD (i.e.: testing the chart). image: - registry: "docker.io" - path: "nginxinc" - name: "nginx-unprivileged" - tag: "latest" - # You might consider using `IfNotPresent` policy, see https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy - pullPolicy: Always + # registry: "docker.io" + # path: "nginxinc" + # name: "nginx-unprivileged" + # tag: "latest" + # see https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy + pullPolicy: IfNotPresent ## Prefer using ingress over openshift routes ingress: