diff --git a/docker/README.md b/docker/README.md index ab213d38e..a1e32953f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,48 +1,103 @@ -# Dockerized +# Docker workflow for DTaaS -This readme will explain the different docker files -and what the purpose of those are. +This readme will explain the building and use of different docker files +for use in development and installation of the DTaaS software. + +**NOTE**: A local docker and docker-compose installation is a pre-requisite +for using docker workflows. ## Folder Structure +There are two dockerfiles for building the containers: + - **client.dockerfile**: Dockerfile for building the client application container. - **libms.dockerfile**: Dockerfile for building the library microservice container. +There are also two compose files for development and local installation scenarios. + - **compose.dev.yml:** Docker Compose configuration for development environment. -- **compose.local.yml:** Docker Compose configuration for local installation. +- **compose.local.yml:** Docker Compose configuration for localhost installation. -## Running Docker Containers +## Build and Publish Docker Images -Follow these steps to set up and run the application with docker. +### Users -### Prerequisites +Build and publish the docker images. This step is required only for +the publication of images to Docker Hub. This publishing step is managed +only by project maintainers. Regular users can skip this step. -- Docker: Install Docker on your machine. +```sh +docker login -u -p +docker build -t intocps/libms:latest -f ./docker/libms.dockerfile . +docker tag intocps/libms:latest intocps/libms:version +docker push intocps/libms:latest +docker push intocps/libms:version + +docker build -t intocps/dtaas-web:latest -f ./docker/client.dockerfile . +docker tag intocps/dtaas-web:latest intocps/dtaas-web:version +docker push intocps/dtaas-web:latest +docker push intocps/dtaas-web:version +``` -### Build Docker Images +To tag version 0.3.1 for example, use -Navigate to the `/docker` folder in your terminal and build the Docker images. -**NB:** the docker images only needs to be build when using **development** environment. +```sh +docker tag intocps/dtaas-web:latest intocps/dtaas-web:0.3.1 +``` + +### Developers + +Use of docker images is handy for developers as well. It is suggested +that developers build the required images locally on their computer and +use them for development purposes. The images can be built using ```sh docker-compose -f compose.dev.yml build ``` -### Run Docker Compose +## Running Docker Containers -For development environment: +Follow these steps to use the application with docker. + +The DTaaS application requires multiple configuration files. The list of +configuration files to be modified are given for each scenario. + +### Development Environment + +This scenario is for software developers: + +The configuration files to be updated are: + +1. client/config/dev.js +2. deploy/config/lib.docker +3. servers/config/gateway/auth + +The relevant docker commands are: ```bash -docker-compose -f compose.dev.yml up -d +docker-compose -f compose.dev.yml up -d #start the application +docker-compose -f compose.dev.yml down #terminate the application ``` -For local environment: +### Localhost Use + +This scenario is for users interested in using the software on +their computers (localhost): + +The configuration files to be updated are: + +1. deploy/config/client/env.local.js +2. deploy/config/lib.docker +3. deploy/config/gateway/auth + +The relevant docker commands are: ```bash -docker-compose -f compose.local.yml up -d +docker-compose -f compose.local.yml up -d #start the application +docker-compose -f compose.local.yml down #terminate the application ``` ### Access the Application diff --git a/docker/compose.local.yml b/docker/compose.local.yml index eeebafb93..8bf3df91a 100644 --- a/docker/compose.local.yml +++ b/docker/compose.local.yml @@ -2,15 +2,11 @@ version: '3' services: client: - image: intocps/dtaas-client - ports: - - "4000:4000" + image: intocps/dtaas-web volumes: - - "../client/config/test.js:/dtaas/client/build/env.js" + - "../deploy/config/client/env.local.js:/dtaas/client/build/env.js" libms: image: intocps/libms - ports: - - "4001:4001" volumes: - "../deploy/config/lib.docker:/dtaas/libms/.env" - "../files:/dtaas/libms/files" @@ -18,8 +14,6 @@ services: ml-workspace-user1: image: mltooling/ml-workspace-minimal:0.13.2 container_name: ml-workspace-user1 - ports: - - "8090:8080" volumes: - "../files/user1:/workspace" - "../files/common:/workspace/common" @@ -35,6 +29,6 @@ services: - "9000:80" volumes: - "../servers/config/gateway/traefik.yml:/etc/traefik/traefik.yml" - - "../servers/config/gateway/auth:/etc/traefik/auth" + - "../deploy/config/gateway/auth:/etc/traefik/auth" - "../servers/config/gateway/dynamic/fileConfig.docker.yml:/etc/traefik/dynamic/fileConfig.yml" - "/var/run/docker.sock:/var/run/docker.sock" \ No newline at end of file