From eed067a85f248398b8cb20bea27055de2f002354 Mon Sep 17 00:00:00 2001 From: popenc Date: Wed, 1 Feb 2023 12:44:07 -0500 Subject: [PATCH 01/10] updated sub refs --- cts_calcs | 2 +- temp_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cts_calcs b/cts_calcs index 85181a6..71faba8 160000 --- a/cts_calcs +++ b/cts_calcs @@ -1 +1 @@ -Subproject commit 85181a6be957bfe272d2cb3c10a10fb455c16826 +Subproject commit 71faba8fe3cd83468b0885cb7e60b7a28a9210fd diff --git a/temp_config b/temp_config index c548aea..71a343e 160000 --- a/temp_config +++ b/temp_config @@ -1 +1 @@ -Subproject commit c548aeac0a0b6e223e2b0588b4632a59b9168ece +Subproject commit 71a343e3b2c6817badaa2b9123e57ea5a26cf7ee From f8fc296415d8639c45a5699df047b0dfad023677 Mon Sep 17 00:00:00 2001 From: popenc Date: Tue, 7 Feb 2023 10:16:02 -0500 Subject: [PATCH 02/10] updated temp_config --- temp_config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temp_config b/temp_config index 71a343e..2b848bc 160000 --- a/temp_config +++ b/temp_config @@ -1 +1 @@ -Subproject commit 71a343e3b2c6817badaa2b9123e57ea5a26cf7ee +Subproject commit 2b848bc9a2262222a78539ea5237d4872bd8358b From af596245b09f2b1bf860519e657b08d4a8622c44 Mon Sep 17 00:00:00 2001 From: popenc Date: Mon, 13 Feb 2023 12:40:26 -0500 Subject: [PATCH 03/10] bumped base image from python 3.9 to 3.10 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6e41aa8..b2889b1 100755 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG version=dev -FROM python:3.9-alpine +FROM python:3.10-alpine ENV APP_USER=www-data From 2bc29392a26954d7c14ee83e61fc551cfa496066 Mon Sep 17 00:00:00 2001 From: popenc Date: Wed, 22 Feb 2023 10:18:18 -0500 Subject: [PATCH 04/10] updated sub refs --- cts_calcs | 2 +- temp_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cts_calcs b/cts_calcs index 71faba8..6082a94 160000 --- a/cts_calcs +++ b/cts_calcs @@ -1 +1 @@ -Subproject commit 71faba8fe3cd83468b0885cb7e60b7a28a9210fd +Subproject commit 6082a94ef8fb74ae7041b8e420fcfe3bc6bdf4a0 diff --git a/temp_config b/temp_config index 2b848bc..3f7299a 160000 --- a/temp_config +++ b/temp_config @@ -1 +1 @@ -Subproject commit 2b848bc9a2262222a78539ea5237d4872bd8358b +Subproject commit 3f7299a79318f391260a67df5457921f92795dd1 From 2c13a34f2b2bbd440ccda80c15d992eb2e4ede60 Mon Sep 17 00:00:00 2001 From: popenc Date: Tue, 14 Mar 2023 10:30:19 -0400 Subject: [PATCH 05/10] updated cts_calcs --- cts_calcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cts_calcs b/cts_calcs index 6082a94..935400b 160000 --- a/cts_calcs +++ b/cts_calcs @@ -1 +1 @@ -Subproject commit 6082a94ef8fb74ae7041b8e420fcfe3bc6bdf4a0 +Subproject commit 935400b62f50ce1681c51b24c1283372a2f81247 From 88e16a732778867d4515b4494e3ff07450033c18 Mon Sep 17 00:00:00 2001 From: popenc Date: Wed, 15 Mar 2023 15:06:25 -0400 Subject: [PATCH 06/10] updated cts calcs with anhydride endpoint --- cts_calcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cts_calcs b/cts_calcs index 935400b..1139e3d 160000 --- a/cts_calcs +++ b/cts_calcs @@ -1 +1 @@ -Subproject commit 935400b62f50ce1681c51b24c1283372a2f81247 +Subproject commit 1139e3dfcb3206b05acdc86777e7f1b87b967ee8 From b6171e31faef2493cce12a03656e470728b0cc04 Mon Sep 17 00:00:00 2001 From: popenc Date: Tue, 11 Jul 2023 12:55:59 -0400 Subject: [PATCH 07/10] updated requirements --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 19dbc42..866a335 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,6 @@ beautifulsoup4==4.10.0 celery==5.2.3 pymongo==4.0.2 python-dotenv==0.19.2 -redis==4.1.4 -requests==2.27.1 +rdkit==2023.3.1 +redis==4.4.4 +requests==2.31.0 From 1254eaf04ad1be69c646d889ab3b0a989df2f75d Mon Sep 17 00:00:00 2001 From: popenc Date: Tue, 11 Jul 2023 13:23:19 -0400 Subject: [PATCH 08/10] changed base image from alpine to slim --- Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2889b1..f005d9e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ # Builds an image for CTS calculator celery worker -ARG version=dev - -FROM python:3.10-alpine +# FROM python:3.10-alpine +FROM python:3.10.12-slim ENV APP_USER=www-data @@ -10,15 +9,17 @@ COPY . /src/ WORKDIR /src + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y build-essential + RUN pip install -r requirements.txt +RUN pip install --upgrade pip + +RUN chown -R $APP_USER:$APP_USER /src/cts_app ENV PYTHONPATH /src:$PYTHONPATH ENV PATH /src:$PATH -RUN apk update && \ - apk upgrade - -RUN adduser -S $APP_USER -G $APP_USER -RUN chown -R $APP_USER:$APP_USER /src - USER $APP_USER From 21307d46665203af8b3d663c593766756caa2a80 Mon Sep 17 00:00:00 2001 From: popenc Date: Tue, 11 Jul 2023 13:26:51 -0400 Subject: [PATCH 09/10] build failure fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f005d9e..c1eb08e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ RUN pip install -r requirements.txt RUN pip install --upgrade pip -RUN chown -R $APP_USER:$APP_USER /src/cts_app +RUN chown -R $APP_USER:$APP_USER /src ENV PYTHONPATH /src:$PYTHONPATH ENV PATH /src:$PATH From 149213c8d302bc2200f21ffa5aabb3534b77fdf0 Mon Sep 17 00:00:00 2001 From: popenc Date: Mon, 8 Apr 2024 15:49:15 -0400 Subject: [PATCH 10/10] updated base image --- Dockerfile | 43 ++++++++++++++++++++++++++++++++++--------- cts_calcs | 2 +- environment.yml | 13 +++++++++++++ start-manager.sh | 2 ++ start-worker.sh | 2 ++ 5 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 environment.yml create mode 100644 start-manager.sh create mode 100644 start-worker.sh diff --git a/Dockerfile b/Dockerfile index c1eb08e..1eadc8f 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,49 @@ # Builds an image for CTS calculator celery worker -# FROM python:3.10-alpine -FROM python:3.10.12-slim +FROM mambaorg/micromamba:1.5.8-alpine3.19 ENV APP_USER=www-data +ENV CONDA_ENV="pyenv" -COPY . /src/ +USER root -WORKDIR /src +RUN adduser -S $APP_USER -G $APP_USER + +RUN apk add --update --no-cache \ + build-base \ + jpeg-dev \ + zlib-dev \ + libjpeg \ + gettext \ + py3-lxml \ + py3-pillow \ + openldap-dev \ + python3-dev \ + linux-headers \ + && rm -rf /var/cache/apk/* +COPY . /src/ +WORKDIR /src -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y build-essential +RUN micromamba create -n $CONDA_ENV -c conda-forge python=3.10 +RUN micromamba install -n $CONDA_ENV -f /src/environment.yml +RUN micromamba clean -p -t -l --trash -y +RUN micromamba run -n $CONDA_ENV pip uninstall -y xhtml2pdf && micromamba run -n $CONDA_ENV pip install xhtml2pdf -RUN pip install -r requirements.txt -RUN pip install --upgrade pip +# # Removes any trace of pip to resolve an open CVE: +# RUN rm -rf \ +# /root/.cache/pip \ +# /usr/local/bin/pip \ +# /usr/local/bin/pip3.10 \ +# /usr/local/bin/pip3 \ +# /usr/local/lib/python3.10/site-packages/pip \ +# /usr/local/lib/python3.10/site-packages/pip-23.0.1.dist-info RUN chown -R $APP_USER:$APP_USER /src +ENV DJANGO_SETTINGS_MODULE "settings" +EXPOSE 8080 + ENV PYTHONPATH /src:$PYTHONPATH ENV PATH /src:$PATH diff --git a/cts_calcs b/cts_calcs index 1139e3d..dc332b6 160000 --- a/cts_calcs +++ b/cts_calcs @@ -1 +1 @@ -Subproject commit 1139e3dfcb3206b05acdc86777e7f1b87b967ee8 +Subproject commit dc332b66e99b19b9ea245a678cd637c95a9ea776 diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..505bf7c --- /dev/null +++ b/environment.yml @@ -0,0 +1,13 @@ +name: cts +channels: + - conda-forge + - defaults +dependencies: + - beautifulsoup4=4.12.3 + - celery=5.3.6 + - pymongo=4.6.3 + - python-dotenv=1.0.1 + - rdkit=2024.3.1 + - requests=2.31.0 + - pip: + - redis==5.0.3 diff --git a/start-manager.sh b/start-manager.sh new file mode 100644 index 0000000..7f34d1e --- /dev/null +++ b/start-manager.sh @@ -0,0 +1,2 @@ +#!/bin/bash +micromamba run -n pyenv celery -A tasks worker -Q manager_queue -l info -n manager_worker -c 1 \ No newline at end of file diff --git a/start-worker.sh b/start-worker.sh new file mode 100644 index 0000000..6a5bd07 --- /dev/null +++ b/start-worker.sh @@ -0,0 +1,2 @@ +#!/bin/bash +micromamba run -n pyenv celery -A tasks worker -Q cts_queue -l info -n cts_worker -c 1 \ No newline at end of file