Update Dockerfile
Browse files- Dockerfile +17 -37
Dockerfile
CHANGED
@@ -1,47 +1,27 @@
|
|
1 |
-
|
2 |
-
FROM python:3.8.5-slim as builder
|
3 |
-
|
4 |
-
# install system dependencies
|
5 |
-
RUN apt-get update
|
6 |
-
RUN apt-get install -y --no-install-recommends build-essential gcc
|
7 |
-
RUN apt-get install -y git
|
8 |
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
|
12 |
-
RUN
|
13 |
-
ENV PATH="/usr/service/venv/bin:$PATH"
|
14 |
-
#ENV PATH=“${PATH}:/root/.local/bin”
|
15 |
-
|
16 |
-
# install python packages into virtual environment
|
17 |
-
COPY requirements.txt .
|
18 |
-
RUN pip install -r requirements.txt --no-cache-dir
|
19 |
RUN pip install numpy==1.20.0
|
20 |
RUN pip install cython==0.29.21
|
21 |
RUN pip install pygco==0.0.16
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
# create a high-privileged user called "python"
|
29 |
-
RUN useradd -o -r -u 0 python
|
30 |
-
|
31 |
-
# make the service directory and give "python" user access rights to the directory
|
32 |
-
RUN mkdir /app && chown python:python /app
|
33 |
-
WORKDIR /app
|
34 |
-
|
35 |
-
# copy python environment and source files to service directory, and give "python" user
|
36 |
-
# access rights to these files.
|
37 |
-
COPY --chown=python:python apps/demo apps/demo
|
38 |
|
39 |
-
|
40 |
-
|
|
|
|
|
41 |
|
42 |
-
# use python environment and start service
|
43 |
EXPOSE 8501
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
1 |
+
FROM python:3.8.5
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
COPY ./requirements.txt /app/requirements.txt
|
6 |
+
RUN pip3 install --no-cache-dir -r /app/requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
RUN pip install numpy==1.20.0
|
8 |
RUN pip install cython==0.29.21
|
9 |
RUN pip install pygco==0.0.16
|
10 |
|
11 |
+
# User
|
12 |
+
RUN useradd -m -u 1000 user
|
13 |
+
USER user
|
14 |
+
ENV HOME /home/user
|
15 |
+
ENV PATH $HOME/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
WORKDIR $HOME
|
18 |
+
RUN mkdir app
|
19 |
+
WORKDIR $HOME/app
|
20 |
+
COPY . $HOME/app
|
21 |
|
|
|
22 |
EXPOSE 8501
|
23 |
+
CMD streamlit run ⓘ_Introduction.py.py \
|
24 |
+
--server.headless true \
|
25 |
+
--server.enableCORS false \
|
26 |
+
--server.enableXsrfProtection false \
|
27 |
+
--server.fileWatcherType none
|