-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
42 lines (29 loc) · 1.24 KB
/
Dockerfile
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
39
40
41
42
FROM python:3.10-buster
WORKDIR /app
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
/bin/bash /tmp/miniconda.sh -b -p /opt/conda && \
rm /tmp/miniconda.sh
ENV PATH=/opt/conda/bin:$PATH
RUN conda install -c conda-forge conda-lock
# Install and activate pyrorisks environment
COPY pyrorisks.conda-lock.yml pyrorisks.conda-lock.yml
RUN conda-lock install --name pyrorisks pyrorisks.conda-lock.yml && conda clean -a
ENV CONDA_DEFAULT_ENV=pyrorisks
ENV PATH /opt/conda/envs/${CONDA_DEFAULT_ENV}/bin:$PATH
RUN echo "conda activate ${CONDA_DEFAULT_ENV}" >> ~/.bashrc
# Install poetry
RUN pip install poetry==1.8.1
# Set environment variables for poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=0 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
VIRTUAL_ENV=/opt/conda/envs/${CONDA_DEFAULT_ENV} \
PATH="/opt/conda/envs/${CONDA_DEFAULT_ENV}/bin:$PATH" \
PYTHONPATH="/opt/conda/envs/${CONDA_DEFAULT_ENV}/lib/python3.10/site-packages:${PYTHONPATH}"
COPY app ./app
COPY pyrorisks ./pyrorisks
COPY pyproject.toml poetry.lock README.md ./
# Install pyrorisks package in pyrorisks conda environment
RUN poetry install
CMD ["bash"]