huathedev commited on
Commit
d7d6958
·
1 Parent(s): b870ebb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -37
Dockerfile CHANGED
@@ -1,47 +1,27 @@
1
- # temporary building stage
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
- # create a virtual environment for python
12
- RUN python -m venv /usr/service/venv
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
- # final stage
24
- FROM python:3.8.5-slim@sha256:0e07cc072353e6b10de910d8acffa020a42467112ae6610aa90d6a3c56a74911
25
-
26
- RUN apt-get update
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
- # use the high-privileged "python" user
40
- USER 0
 
 
41
 
42
- # use python environment and start service
43
  EXPOSE 8501
44
- #ENV PATH="/usr/service/venv/bin:$PATH"
45
- #ENV PATH=“${PATH}:/root/.local/bin”
46
- #ENV PYTHONPATH=.
47
- ENTRYPOINT ["streamlit", "run", "apps/demo/ⓘ_Introduction.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
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