From 335204d3ee87c2a234f91ddaca804f487373d637 Mon Sep 17 00:00:00 2001 From: lucio Date: Wed, 27 Mar 2024 12:04:49 +0100 Subject: [PATCH] docker info updated --- DOCKER-INSTRUCTION.md | 22 +++++++++++++++++ Dockerfile | 9 +------ Dockerfile-standalone | 8 +++++++ buildImageAndStart.sh | 7 ++---- docker-compose-standalone.yml | 45 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 44 ++++------------------------------ 6 files changed, 83 insertions(+), 52 deletions(-) create mode 100644 DOCKER-INSTRUCTION.md create mode 100644 Dockerfile-standalone create mode 100644 docker-compose-standalone.yml diff --git a/DOCKER-INSTRUCTION.md b/DOCKER-INSTRUCTION.md new file mode 100644 index 0000000..2418827 --- /dev/null +++ b/DOCKER-INSTRUCTION.md @@ -0,0 +1,22 @@ +# Docker Instruction + +Instruction to generate e run storagehub docker image + +## Dockerfile - DokerCompose + +This image is ready to be deployed in a new environment. +The Dockerfile generate an image without configurations (container, service etc.), all the configurations must be provided at image start time. +In fact the docker-compose.yml requires 3 environmental variables set at start time: APP_PORT, JACKRABBIT_FOLDER, CONTAINER_SERVICE_FILE_FOLDER. + +``` +APP_PORT=8080 JACKRABBIT_FOLDER=/data/jackrabbit CONTAINER_SERVICE_FILE_FOLDER=/etc/smartgears-config docker compose up +``` + +## Dockerfile - DokerCompose standalone + +The image generated from Dockerfile-standalone contains all the configuration to run on a fully isolated container. +The docker-compose-standalone.yml contains the declaration of all the services needed (postgres and minio) teking all the configuration from the local ./docker folder + +``` +docker compose -f docker-compose-standalone.yml up +``` \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9c71345..63e2824 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,4 @@ FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java17-tomcat10.1.19 - ARG REPOUSER=admin - ARG REPOPWD=admin - COPY ./target/storagehub.war /tomcat/webapps/ - COPY ./docker/jackrabbit /app/jackrabbit + COPY ./docker/jackrabbit/bootstrap.properties /app/jackrabbit/ COPY ./docker/storagehub.xml /tomcat/conf/Catalina/localhost/ - COPY ./docker/logback.xml /etc/ - COPY ./docker/container.ini /etc/ - RUN mkdir -p /etc/config/StorageHub - COPY ./docker/storage-settings.properties /etc/config/StorageHub/ \ No newline at end of file diff --git a/Dockerfile-standalone b/Dockerfile-standalone new file mode 100644 index 0000000..eb4d582 --- /dev/null +++ b/Dockerfile-standalone @@ -0,0 +1,8 @@ +FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java17-tomcat10.1.19 + COPY ./target/storagehub.war /tomcat/webapps/ + COPY ./docker/jackrabbit /app/jackrabbit + COPY ./docker/storagehub.xml /tomcat/conf/Catalina/localhost/ + COPY ./docker/logback.xml /etc/ + COPY ./docker/container.ini /etc/ + RUN mkdir -p /etc/config/StorageHub + COPY ./docker/storage-settings.properties /etc/config/StorageHub/ \ No newline at end of file diff --git a/buildImageAndStart.sh b/buildImageAndStart.sh index 18933df..4d8fb8b 100755 --- a/buildImageAndStart.sh +++ b/buildImageAndStart.sh @@ -10,9 +10,6 @@ compile=false mvn clean package -docker build -t $NAME . - -docker-compose build - -docker-compose up +docker-compose -f docker-compose-standalone build +docker-compose -f docker-compose-standalone up diff --git a/docker-compose-standalone.yml b/docker-compose-standalone.yml new file mode 100644 index 0000000..d29b2e7 --- /dev/null +++ b/docker-compose-standalone.yml @@ -0,0 +1,45 @@ +version: '3.7' +services: + postgres: + image: postgres:16.2 + restart: always + environment: + - POSTGRES_DB=workspace-db + - POSTGRES_USER=ws-db-user + - POSTGRES_PASSWORD=dbPwd + logging: + options: + max-size: 10m + max-file: "3" + ports: + - '5423:5432' + volumes: + - ./postgres-data:/var/lib/postgresql/data + copy the sql script to create tables + - ./sql/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql + storagehub: + build: + dockerfile: Dockerfile-standalone + environment: + _JAVA_OPTIONS: + -Xdebug + -agentlib:jdwp=transport=dt_socket,server=y,suspend=${SUSPEND:-n},address=*:5005 + ports: + - '8081:8080' + - '5005:5005' + + minio: + image: minio/minio + ports: + - "9000:9000" + - "9001:9001" + volumes: + - minio_storage:/data + environment: + MINIO_ROOT_USER: SHUBTEST + MINIO_ROOT_PASSWORD: wJalrXUtnFEMI/K7MDENG/bPxRfiCY + command: server --console-address ":9001" /data + +volumes: + minio_storage: {} + diff --git a/docker-compose.yml b/docker-compose.yml index ae81e77..751c699 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,44 +1,10 @@ version: '3.7' services: - postgres: - image: postgres:16.2 - restart: always - environment: - - POSTGRES_DB=workspace-db - - POSTGRES_USER=ws-db-user - - POSTGRES_PASSWORD=dbPwd - logging: - options: - max-size: 10m - max-file: "3" - ports: - - '5423:5432' - volumes: - - ./postgres-data:/var/lib/postgresql/data - copy the sql script to create tables - - ./sql/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql storagehub: - build: . - environment: - _JAVA_OPTIONS: - -Xdebug - -agentlib:jdwp=transport=dt_socket,server=y,suspend=${SUSPEND:-n},address=*:5005 + image: d4science/staragehub:latest ports: - - '8081:8080' - - '5005:5005' - - minio: - image: minio/minio - ports: - - "9000:9000" - - "9001:9001" + - '${APP_PORT}:8080' volumes: - - minio_storage:/data - environment: - MINIO_ROOT_USER: SHUBTEST - MINIO_ROOT_PASSWORD: wJalrXUtnFEMI/K7MDENG/bPxRfiCY - command: server --console-address ":9001" /data - -volumes: - minio_storage: {} - + - ${JACKRABBIT_FOLDER}:/app/jackrabbit + - ${SMARTGEARS_CONFIG_FOLDER}:/etc + \ No newline at end of file