-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_Worker_Celery
38 lines (28 loc) · 1.65 KB
/
Dockerfile_Worker_Celery
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Usar uma imagem base com Conda pré-instalado
FROM amazoncorretto:11 AS jdk-stage
FROM continuumio/miniconda3
COPY --from=jdk-stage /usr/lib/jvm /usr/lib/jvm
COPY --from=jdk-stage /etc/alternatives/java /etc/alternatives/java
ENV JAVA_HOME="/usr/lib/jvm/java-11-amazon-corretto"
ENV PATH="$JAVA_HOME/bin:$PATH"
# Definir o diretório de trabalho no container
WORKDIR /app
# Copiar o arquivo de dependências do Conda (environment.yml) para o container
COPY libs/pdf2chemicals ./libs/pdf2chemicals
COPY requirements.txt /tmp/requirements.txt
# Criar um ambiente Conda com as dependências especificadas no arquivo environment.yml
RUN conda env create -f libs/pdf2chemicals/environment.yml -y && \
conda clean -a
# Configurar o ambiente Conda como padrão
ENV CONDA_DEFAULT_ENV=pdf2chemicals
ENV PATH=/opt/conda/envs/pdf2chemicals/bin:$PATH
ENV LD_LIBRARY_PATH=/opt/conda/envs/pdf2chemicals/lib:$LD_LIBRARY_PATH
RUN pip install -e libs/pdf2chemicals && \
conda install -c conda-forge cudatoolkit==11.8.0 -y && \
pip uninstall -y torch torchvision torchaudio && \
conda install pytorch=2.1.0 torchvision=0.16.0 torchaudio=2.1.0 pytorch-cuda=11.8 -c pytorch -c nvidia -y && \
pip install torch_scatter==2.1.2 torch_sparse==0.6.18 torch_cluster==1.6.3 torch_spline_conv==1.2.2 -f https://data.pyg.org/whl/torch-2.1.0+cu118.html && \
pip install torch_geometric==2.4.0 && \
python -m spacy download en_core_web_trf && \
pip install --no-cache-dir -r /tmp/requirements.txt
CMD ["celery", "-A", "labsoa_website_backend", "worker", "--queues=pdf2chemicals_tasks", "--prefetch-multiplier=1", "--autoscale=2,1", "--max-tasks-per-child=1", "--loglevel=INFO"]