logasja commited on
Commit
a5cc3b9
·
1 Parent(s): de3e460

Updated docker file to be multi-stage build

Browse files
Files changed (3) hide show
  1. .dockerignore +1 -0
  2. Dockerfile +26 -14
  3. Dockerfile.bkup +18 -0
.dockerignore CHANGED
@@ -1,2 +1,3 @@
1
  /venv
2
  /flagged
 
 
1
  /venv
2
  /flagged
3
+ /.env
Dockerfile CHANGED
@@ -1,18 +1,30 @@
1
- FROM continuumio/miniconda3
2
- EXPOSE 7860
 
 
 
3
 
4
- RUN apt-get update && \
5
- apt-get install -y --no-install-recommends libgl1-mesa-glx && \
6
- apt-get install -y --no-install-recommends libglib2.0-0 && \
7
- apt-get clean && \
8
- rm -rf /var/lib/apt/lists/*
9
 
10
- ENV GRADIO_SERVER_NAME=0.0.0.0
11
- WORKDIR /workspace
12
 
13
- ADD environment.yaml /workspace/environment.yaml
14
- RUN conda env update -n base --file environment.yaml && \
15
- pip install typing-extensions -U
16
 
17
- ADD app.py /workspace/
18
- CMD [ "python" , "/workspace/app.py" ]
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.7-slim as builder
2
+
3
+ RUN apt update && \
4
+ apt install --no-install-recommends -y build-essential gcc
5
+ COPY requirements_personal.txt /req.txt
6
 
7
+ RUN python -m pip install --upgrade pip && \
8
+ pip install --no-cache-dir --user -r req.txt && \
9
+ pip install --no-cache-dir --user typing-extensions -U
 
 
10
 
11
+ # Stage 2: Runtime
12
+ FROM nvidia/cuda:11.3.1-cudnn8-runtime
13
 
14
+ RUN rm /etc/apt/sources.list.d/cuda.list
15
+ RUN rm /etc/apt/sources.list.d/nvidia-ml.list
 
16
 
17
+ ENV TZ=America/New_York
18
+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
19
+
20
+ RUN apt update && \
21
+ apt install --no-install-recommends -y build-essential software-properties-common && \
22
+ add-apt-repository -y ppa:deadsnakes/ppa && \
23
+ apt install --no-install-recommends -y python3.7 python3-distutils && \
24
+ # update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \
25
+ # update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2 && \
26
+ apt clean && rm -rf /var/lib/apt/lists/*
27
+ COPY --from=builder /root/.local/lib/python3.7/site-packages /usr/local/lib/python3.7/dist-packages
28
+ COPY app.py app.py
29
+ CMD ["python3", "app.py"]
30
+ EXPOSE 7860
Dockerfile.bkup ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM continuumio/miniconda3
2
+ EXPOSE 7860
3
+
4
+ RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends libgl1-mesa-glx && \
6
+ apt-get install -y --no-install-recommends libglib2.0-0 && \
7
+ apt-get clean && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ ENV GRADIO_SERVER_NAME=0.0.0.0
11
+ WORKDIR /workspace
12
+
13
+ ADD environment.yaml /workspace/environment.yaml
14
+ RUN conda env update -n base --file environment.yaml && \
15
+ pip install typing-extensions -U
16
+
17
+ ADD app.py /workspace/
18
+ CMD [ "python" , "/workspace/app.py" ]