[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

OpenShift Docker build strategy using Dockerfiles & MongoDB Database creation



Hello everybody,

I'm new to OpenShift Origin and I have a few questions:

My goal is to run an existing DevOps Dashboard Project on OpenShift Origin. The project does already workes on Docker (with Docker-compose.yaml and Dockerfile), consisting of the following 3 containers:
1. MongoDB
2. API
3. UI

In the Dockerfile of the API project I have the following commands:

FROM docker.io/openjdk:8-jre

MAINTAINER Hygieia capitalone com


ENV SPRING_DATA_MONGODB_DATABASE=dashboard
ENV SPRING_DATA_MONGODB_HOST=hygieia-mongodb
ENV SPRING_DATA_MONGODB_PORT=27017
ENV SPRING_DATA_MONGODB_USERNAME=dashboarduser
ENV SPRING_DATA_MONGODB_PASSWORD=dbpassword
ENV AUTH_EXPIRATION_TIME=7200000
ENV jasypt.encryptor.password=hygieiasecret
ENV AUTH_SECRET=hygieiasecret

RUN \
mkdir /hygieia

#COPY hygieia/ /hygieia
COPY *.jar /hygieia/
COPY properties-builder.sh /hygieia/

WORKDIR /hygieia

VOLUME ["/hygieia/logs"]

EXPOSE 8080
CMD ./properties-builder.sh &&\
java -Djava.security.egd=file:/dev/./urandom -jar api.jar --spring.config.location=/hygieia/dashboard.properties

The Docker-compose.yaml is as follows:
mongodb:
  image: mongo:latest
  environment:
    - MONGODB_USERNAME=dashboarduser
    - MONGODB_DATABASE=dashboarddb
    - MONGODB_PASSWORD=dbpassword
  volumes:
    - mongo:/data/db:rw
  ports:
    - "27017:27017"

hygieia-api:
  image: hygieia-api:latest
  volumes:
  - logs:/hygieia/logs
  environment:
    - jasypt.encryptor.password=hygieiasecret
    - SPRING_DATA_MONGODB_DATABASE=dashboarddb
    - SPRING_DATA_MONGODB_HOST=mongodb
    - SPRING_DATA_MONGODB_PORT=27017
    - SPRING_DATA_MONGODB_USERNAME=dashboarduser
    - SPRING_DATA_MONGODB_PASSWORD=dbpassword
    - AUTH_EXPIRATION_TIME=7200000
    - AUTH_SECRET=hygieiasecret
  links:
  - mongodb

hygieia-ui:
  image: hygieia-ui:latest
  container_name: hygieia-ui
  ports:
  - "8088:80"
  links:
  - hygieia-api

==> The sub projects (API, UI) have a sub directory called "docker". In this directory there is a Dockerfile, a .jar file, and relevant .properties and .sh files).

I have specified a Docker build strategy in the DeploymentConfig of the template file pointing to my Dockerfiles, however, it says that it can't find my files while building the images, which I have defined (*.jar, .sh file and properties file). My question is now, how can I bring those files into the build process that they work with my dockerfiles?


Furthermore, could you tell me what is the best way to create a new Database inside MongoDB when initializing the pods/containers with the help of the .yaml template file? Which is the best section to do that?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]