-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
44 lines (35 loc) · 1.23 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
43
44
# Stage 1: Build and pack the conda environment
FROM continuumio/miniconda3 AS build
COPY requirements.txt .
RUN conda init bash && \
. /opt/conda/etc/profile.d/conda.sh && \
conda create --name myenv python=3.9 && \
conda activate myenv && \
conda install -c conda-forge spot && \
pip install -r requirements.txt
# && \
#conda pack -n myenv -o /tmp/myenv.tar.gz
# Install conda-pack:
RUN conda install -c conda-forge conda-pack
# Use conda-pack to create a standalone enviornment
# in /venv:
RUN conda-pack -n myenv -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar
# We've put venv in same path it'll be in final image,
# so now fix up paths:
RUN /venv/bin/conda-unpack
# Stage 2: Setup the runtime
FROM debian:buster-slim
# Install Java
# RUN apt-get update && \
# apt-get install -y openjdk-11-jdk && \
# apt-get clean;
COPY . .
COPY --from=build /venv /venv
WORKDIR /src
EXPOSE 5000
# Make RUN commands use the new environment
SHELL ["/bin/bash", "-c"]
#CMD /bin/bash -c "source /venv/bin/activate && python -m spacy download en_core_web_sm && python app.py"
CMD /bin/bash -c "source /venv/bin/activate && python app.py"