-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-backend
54 lines (43 loc) · 1.92 KB
/
Dockerfile-backend
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
45
46
47
48
49
50
51
52
53
54
FROM python:3.10-bullseye
# Geneplexus Job Runner
# this is the Dockerfile to build an image that will run the model and save html results
# it uses the same Python code as the application
# but is a different Python and set of libs for speed
# the main difference is that this image/container does not run a webserver,
# it only runs the "runner.sh" shell script that uses environment variables to
# the parameters for the model
# those environment variables are set when the docker container is run
# ARG CONDA_VERSION=4.9.2
ARG PYTHON_VERSION=3.10
ARG APP_POST_URL_ARG="https://geneplexusdev1.azurewebsites.net/jobs"
ENV USERNAME=dockeruser
RUN apt-get update --fix-missing && \
apt-get install -y apt-utils wget bzip2 curl zip && \
apt-get install -y fuse && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
RUN useradd --create-home $USERNAME && \
echo PATH=$PATH:/home/$USERNAME/.local/bin >> /home/$USERNAME/.bashrc
WORKDIR /home/$USERNAME
USER $USERNAME
COPY mljob/requirements.txt requirements.txt
# install packages using conda, one at a time
# the requirements file is in pip format, not conda, so need to install one a time
RUN pip install -r requirements.txt
COPY mljob mljob
COPY runner.py .
COPY runner.sh .
# this needs to be set for the runner to know how to POST status updates.
ENV APP_POST_URL=$APP_POST_URL_ARG
# note about back-end data files
# the data files needed by the model are not copied into this container
# but the scripts assume the files are mounted and available to the container
# based on the DATA_PATH env variable, set when the the container is run
# RUN CMD
# this command launches the python model runner shell script
# which reads environment variables
# invoking this container requires setting env variables on the command line
# see runner.sh for those
CMD cd /home/dockeruser && ./runner.sh
# no entry point is needed since the container runs a single script ('job')
ENTRYPOINT []