Skip to content

Commit a1bfc71

Browse files
committed
Adding Docker config
1 parent 8ac9aa0 commit a1bfc71

File tree

24 files changed

+8013
-4
lines changed

24 files changed

+8013
-4
lines changed

.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Project
22
COMPOSE_PROJECT_NAME=deep-root-gen
33
APP_VERSION=0.1.0
4-
GITHUB_CONTAINER_REPO=ghcr.io/jbris/${COMPOSE_PROJECT_NAME}
54

65
# Postgres
76
DB_NAME=deeprootgen

.github/workflows/docker-build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: Docker Build
22

33
on:
44
workflow_dispatch: {}
5-
5+
release:
6+
types:
7+
- published
8+
69
permissions:
710
actions: write
811
packages: write

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
![DeepRootGen](docs/logos/deep_root_gen.png)
2+
13
# DeepRootGen
24

3-
A simulation model for the digital reconstruction of 3D root system architectures. Integrated with a simulation-based inference generative deep learning model.
5+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
6+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7+
[![Tests](https://github.com/JBris/deep-root-gen/actions/workflows/tests.yaml/badge.svg?branch=main)](https://github.com/JBris/deep-root-gen/actions/workflows/tests.yaml)
8+
[![Documentation](https://github.com/JBris/deep-root-gen/actions/workflows/docs.yaml/badge.svg?branch=main)](https://github.com/JBris/deep-root-gen/actions/workflows/docs.yaml)
9+
[![Build](https://github.com/JBris/deep-root-gen/actions/workflows/docker-build.yaml/badge.svg?branch=main)](https://github.com/JBris/deep-root-gen/actions/workflows/docker-build.yaml)
10+
11+
*A simulation model for the digital reconstruction of 3D root system architectures. Integrated with a simulation-based inference generative deep learning model.*
12+
13+
# Table of contents
14+
15+
- [DeepRootGen](#deeprootgen)
16+
- [Table of contents](#table-of-contents)
17+
- [Introduction](#introduction)
18+
- [Data Schema](#data-schema)
19+
- [Contacts](#contacts)
20+
21+
# Introduction
22+
23+
This repository contains an implementation of a simulation model for generating the root system architecture, for the estimation of root parameters as informed by observational data collected from the field.
24+
25+
# Data Schema
26+
27+
The primary purpose of DeepRootGen is to output a synthetic root system into a tabular data format. The tabular data are composed of several columns:
28+
29+
| Column | Type | Description |
30+
| ------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
31+
| id | Discrete | A unique ID for each row. |
32+
| plant_id | Discrete | A unique ID for each plant. |
33+
| organ_id | Discrete | A unique ID for each root. |
34+
| order | Discrete | The plant order. A first order root grows from the plant base, second order roots emerge from first order roots, third order roots emerge from second order roots, and so on. |
35+
| root_type | Discrete | The root type classification. Can be one of 1 = Structural Root or 2 = Fine Root. |
36+
| segment_rank | Discrete | The rank number for each root segment. A small rank refers to segments that are close to the root base, while a large rank refers to roots that are near the root apex. |
37+
| parent | Discrete | The parent organ of the root segment. The parent node of the organ within the GroIMP graph. Used by the XEG reader to recursively import the synthetic root data. |
38+
| coordinates | Continuous | The combined 3D coordinates (x, y, and z) of each root segment. |
39+
| diameter | Continuous | The root segment diameter. |
40+
| length | Continuous | The root segment length. |
41+
| x | Continuous | The x coordinate of the root segment. |
42+
| y | Continuous | The y coordinate of the root segment. |
43+
| z | Continuous | The z coordinate of the root segment. |
44+
45+
# Contacts
46+
47+
- DeepRootGen Developer: James Bristow
48+
- DeepRootGen Project Supervisor: Junqi Zhu
49+
- Crop System Modeller: Xiumei Yang

apptainer/python/Apptainer.0.1.0

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Bootstrap: docker
2+
From: ghcr.io/jbris/deep-root-gen:0.1.0
3+
4+
%labels
5+
Maintainer [email protected]
6+
Version 0.1.0
7+
8+
%post
9+
prefect config set PREFECT_API_ENABLE_HTTP2=false
10+
prefect config set PREFECT_API_TLS_INSECURE_SKIP_VERIFY=true
11+
prefect config set PREFECT_EXPERIMENTAL_ENABLE_TASK_SCHEDULING=true
12+
13+
%help
14+
This is a container to run the DeepRootGen model.
15+
16+
%runscript
17+
exec "$@"

docker-compose.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
services:
2+
3+
mlflow:
4+
image: ghcr.io/jbris/deep-root-gen:${APP_VERSION}
5+
build:
6+
context: .
7+
dockerfile: ./dockerfiles/python/Dockerfile.${APP_VERSION}
8+
args:
9+
BUILD_DATE: date -u +'%Y-%m-%dT%H:%M:%SZ'
10+
restart: always
11+
stop_grace_period: 10s
12+
environment:
13+
MLFLOW_BACKEND_STORE_URI: $MLFLOW_BACKEND_STORE_URI
14+
MLFLOW_S3_ENDPOINT_URL: http://minio:9000
15+
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
16+
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
17+
ports:
18+
- 5000:5000
19+
command: >
20+
mlflow server --serve-artifacts --host 0.0.0.0 --port 5000
21+
--backend-store-uri "${MLFLOW_BACKEND_STORE_URI}" --default-artifact-root s3://mlflow/
22+
--expose-prometheus /prometheus
23+
24+
prefect-server:
25+
image: ghcr.io/jbris/deep-root-gen:${APP_VERSION}
26+
build:
27+
context: .
28+
dockerfile: ./dockerfiles/python/Dockerfile.${APP_VERSION}
29+
args:
30+
BUILD_DATE: date -u +'%Y-%m-%dT%H:%M:%SZ'
31+
restart: always
32+
stop_grace_period: 10s
33+
environment:
34+
PREFECT_UI_URL: http://127.0.0.1:4200/api
35+
PREFECT_API_URL: http://127.0.0.1:4200/api
36+
PREFECT_SERVER_API_HOST: 0.0.0.0
37+
PREFECT_API_DATABASE_CONNECTION_URL: $PREFECT_API_DATABASE_CONNECTION_URL
38+
ports:
39+
- 4200:4200
40+
entrypoint: >
41+
prefect server start
42+
43+
postgres:
44+
image: ${COMPOSE_PROJECT_NAME}-postgres:${APP_VERSION}
45+
build:
46+
context: .
47+
dockerfile: ./dockerfiles/postgres/Dockerfile.${APP_VERSION}
48+
args:
49+
BUILD_DATE: date -u +'%Y-%m-%dT%H:%M:%SZ'
50+
restart: always
51+
stop_grace_period: 10s
52+
environment:
53+
POSTGRES_PASSWORD: $DB_PASSWORD
54+
POSTGRES_DB: $DB_NAME
55+
POSTGRES_USER: $DB_USER
56+
ports:
57+
- 5432:5432
58+
volumes:
59+
- postgres-data:/var/lib/postgresql/data
60+
61+
minio:
62+
image: minio/minio:RELEASE.2023-05-27T05-56-19Z
63+
restart: always
64+
stop_grace_period: 10s
65+
working_dir: /data
66+
volumes:
67+
- minio-data:/data
68+
ports:
69+
- 9000:9000
70+
- 9001:9001
71+
environment:
72+
MINIO_ACCESS_KEY: $MINIO_ACCESS_KEY
73+
MINIO_SECRET_KEY: $MINIO_SECRET_KEY
74+
MINIO_ROOT_USER: $MINIO_ROOT_USER
75+
MINIO_ROOT_PASSWORD: $MINIO_ROOT_PASSWORD
76+
MINIO_STORAGE_USE_HTTPS: False
77+
MINIO_PROMETHEUS_AUTH_TYPE: public
78+
command: server --console-address :9001 --address :9000 /data
79+
80+
mc:
81+
image: minio/mc:RELEASE.2023-05-30T22-41-38Z
82+
environment:
83+
MINIO_PORT: 9000
84+
MINIO_ACCESS_KEY: $MINIO_ACCESS_KEY
85+
MINIO_SECRET_KEY: $MINIO_SECRET_KEY
86+
depends_on:
87+
- minio
88+
entrypoint: >
89+
/bin/sh -c ' sleep 5;
90+
/usr/bin/mc config host add s3 http://minio:9000 ${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY} --api S3v4;
91+
[[ ! -z "`/usr/bin/mc ls s3 | grep challenge`" ]] || /usr/bin/mc mb s3/mlflow; /usr/bin/mc policy download s3/mlflow;
92+
[[ ! -z "`/usr/bin/mc ls s3 | grep challenge`" ]] || /usr/bin/mc mb s3/data; /usr/bin/mc policy download s3/data; exit 0; '
93+
94+
cloudbeaver:
95+
image: dbeaver/cloudbeaver:23.3.1
96+
restart: always
97+
stop_grace_period: 10s
98+
ports:
99+
- 8978:8978
100+
volumes:
101+
- cloudbeaver-data:/opt/cloudbeaver/workspace
102+
103+
metabase:
104+
image: metabase/metabase:v0.48.0
105+
restart: unless-stopped
106+
stop_grace_period: 10s
107+
environment:
108+
MB_DB_TYPE: postgres
109+
MB_DB_HOST: postgres
110+
MB_DB_PORT: 5432
111+
MB_DB_PASS: $DB_PASSWORD
112+
MB_DB_DBNAME: $DB_NAME
113+
MB_DB_USER: $DB_USER
114+
MB_DB_FILE: /metabase-data/metabase.db
115+
MB_PROMETHEUS_SERVER_PORT: 3001
116+
ports:
117+
- 3000:3000
118+
- 3001:3001
119+
volumes:
120+
- metabase-data:/metabase-data
121+
122+
networks:
123+
default:
124+
name: $COMPOSE_PROJECT_NAME
125+
driver: bridge
126+
127+
volumes:
128+
minio-data: {}
129+
postgres-data: {}
130+
cloudbeaver-data: {}
131+
metabase-data: {}
132+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM postgres:15.3-bullseye
2+
3+
ARG BUILD_DATE
4+
5+
6+
7+
LABEL org.label-schema.build-date=$BUILD_DATE
8+
9+
COPY sql/init.sql /docker-entrypoint-initdb.d/init.sql
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM python:3.10.14-bullseye as base
2+
3+
ARG BUILD_DATE
4+
5+
6+
7+
LABEL org.label-schema.build-date=$BUILD_DATE
8+
9+
WORKDIR /app
10+
11+
COPY README.md README.md
12+
13+
COPY deeprootgen deeprootgen
14+
15+
RUN apt-get update \
16+
&& apt-get install -y --no-install-recommends build-essential libpq-dev graphviz \
17+
&& apt-get clean \
18+
&& rm -rf /var/lib/apt/lists/* \
19+
&& rm -rf /tmp/downloaded_packages
20+
21+
FROM base as builder
22+
23+
ENV POETRY_NO_INTERACTION=1 \
24+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
25+
POETRY_VIRTUALENVS_CREATE=1 \
26+
POETRY_CACHE_DIR=/tmp/poetry_cache \
27+
PATH="/root/.local/bin:$PATH"
28+
29+
COPY pyproject.toml poetry.lock ./
30+
31+
RUN curl -sSL https://install.python-poetry.org | python3 -\
32+
&& poetry install --without dev \
33+
&& rm -rf $POETRY_CACHE_DIR \
34+
&& curl -sSL https://install.python-poetry.org | python3 - --uninstall
35+
36+
FROM base as runtime
37+
38+
ENV VIRTUAL_ENV=/app/.venv \
39+
PATH="/app/.venv/bin:$PATH"
40+
41+
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
42+
43+
RUN chmod -R 755 /app

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/logos/deep_root_gen.png

5.88 KB
Loading

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

0 commit comments

Comments
 (0)