-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDockerfile
56 lines (43 loc) · 1.69 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
45
46
47
48
49
50
51
52
53
54
55
56
FROM ubuntu:20.04
# Install nginx (see http://nginx.org/en/linux_packages.html#Ubuntu)
RUN \
apt-get update \
&& apt-get install -y curl gnupg2 ca-certificates lsb-release \
&& echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list \
&& curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - \
&& apt-get update \
&& apt-get install nginx \
&& apt-get install -y nginx-module-njs
# Install python3 and pip
RUN \
apt-get update \
&& apt-get install -y python3.8 python3-pip \
&& ln -s /usr/bin/python3.8 /usr/bin/python
# && ln -s /usr/bin/pip3 /usr/bin/pip
# Install lib required for psycopg2
RUN \
apt-get update \
&& apt-get install -y libpq-dev
# Install gunicorn and uvicorn to run FastAPI optimized
RUN pip install --no-cache-dir "uvicorn[standard]" gunicorn faker
RUN mkdir /resources
WORKDIR /resources/app/
# First install only the dependencies by not copying the code
COPY backend/setup.py /resources/app/
RUN pip install .
# Then install also the code. This speeds up build time when only the code changes
COPY backend/ /resources/app
RUN pip install .
COPY ./docker/server/start.sh /resources/start.sh
RUN chmod +x /resources/start.sh
COPY ./docker/entrypoint.sh /resources/entrypoint.sh
RUN chmod +x /resources/entrypoint.sh
COPY ./docker/server/gunicorn_conf.py /gunicorn_conf.py
COPY docker/nginx /etc/nginx
COPY webapp/build /resources/webapp
ENV PYTHONPATH=/resources/app \
MODULE_NAME=lab_workspace_manager.app \
WEB_CONCURRENCY="1"
LABEL org.opencontainers.image.source https://github.com/SAP/machine-learning-lab
ENTRYPOINT ["/bin/bash"]
CMD ["/resources/entrypoint.sh"]