Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to dev-kube #123

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,50 @@
# Builds an image for CTS calculator celery worker

ARG version=dev

FROM python:3.9-alpine
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 pip install -r requirements.txt
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/*

ENV PYTHONPATH /src:$PYTHONPATH
ENV PATH /src:$PATH
COPY . /src/
WORKDIR /src

RUN apk update && \
apk upgrade
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

# # 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 adduser -S $APP_USER -G $APP_USER
RUN chown -R $APP_USER:$APP_USER /src

ENV DJANGO_SETTINGS_MODULE "settings"
EXPOSE 8080

ENV PYTHONPATH /src:$PYTHONPATH
ENV PATH /src:$PATH

USER $APP_USER
13 changes: 13 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions start-manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
micromamba run -n pyenv celery -A tasks worker -Q manager_queue -l info -n manager_worker -c 1
2 changes: 2 additions & 0 deletions start-worker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
micromamba run -n pyenv celery -A tasks worker -Q cts_queue -l info -n cts_worker -c 1
Loading