OuroborosM commited on
Commit
c9a8866
·
1 Parent(s): ca8a774

update dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +93 -11
Dockerfile CHANGED
@@ -3,26 +3,108 @@
3
 
4
  FROM python:3.10
5
 
6
- WORKDIR /app
7
 
8
- COPY ./requirements.txt /app/requirements.txt
9
- # COPY ./packages.txt /app/packages.txt
10
 
11
- # RUN apt-get update && xargs -r -a /app/packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
12
- RUN pip3 install --no-cache-dir -r /app/requirements.txt
13
 
14
- # User
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  RUN useradd -m -u 1000 user
 
 
16
  USER user
17
- ENV HOME /home/user
18
- ENV PATH $HOME/.local/bin:$PATH
19
 
20
- WORKDIR $HOME
21
- RUN mkdir app
 
 
 
 
 
 
22
  WORKDIR $HOME/app
23
- COPY . $HOME/app
 
 
24
 
25
  EXPOSE 8501
 
26
  CMD streamlit run app.py \
27
  --server.headless true \
28
  --server.enableCORS false \
 
3
 
4
  FROM python:3.10
5
 
6
+ WORKDIR /code
7
 
8
+ # ENV PIP_TARGET=/home/user/app/pip
9
+ # ENV PYTHONPATH=${PYTHONPATH}:${PIP_TARGET}
10
 
11
+ # RUN python -m venv /home/user/app/venv
12
+ # ENV PATH="/home/user/app/bin:$PATH"
13
 
14
+ COPY ./requirements.txt /code/requirements.txt
15
+
16
+ RUN pip install --no-cache-dir --upgrade pip
17
+
18
+ # RUN pip install --no-cache-dir lit
19
+
20
+ # Install playsound separately with the --no-build-isolation flag
21
+ # RUN pip install --no-cache-dir --no-build-isolation playsound
22
+
23
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
24
+
25
+ RUN wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf - \
26
+ && cd openssl-1.1.1u \
27
+ && ./config --prefix=/usr/local \
28
+ && make -j $(nproc) \
29
+ make install_sw install_ssldirs \
30
+ ldconfig -v
31
+ ENV SSL_CERT_DIR=/usr/lib/ssl/certs
32
+ ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
33
+
34
+ # Access for folder
35
+ ENV TORCH_HOME /home/user/app
36
+ # RUN mkdir -p /home/user/torchcache && chmod -R u+rwx /home/user/torchcache
37
+
38
+ # ENV TORCH_HOME /home/user/.cache/torch
39
+ RUN mkdir -p /home/user/.cache/torch && chmod -R u+rwx /home/user/.cache/torch
40
+ RUN mkdir -p /home/user/.cache/torch/sentence_transformers && \
41
+ chmod -R u+rwx /home/user/.cache/torch/sentence_transformers
42
+
43
+ RUN mkdir -p /home/user/.cache/torch/sentence_transformers/sentence-transformers_all-MiniLM-L6-v2 && \
44
+ chmod -R u+rwx /home/user/.cache/torch/sentence_transformers/sentence-transformers_all-MiniLM-L6-v2
45
+
46
+ RUN mkdir -p /home/user/app/datasets &&\
47
+ chmod -R 777 /home/user/app/datasets
48
+
49
+ RUN mkdir -p /home/user/app/datasets/downloads &&\
50
+ chmod -R 777 /home/user/app/datasets/downloads
51
+
52
+ RUN mkdir -p /home/user/app/cache &&\
53
+ chmod -R 777 /home/user/app/cache
54
+
55
+ RUN mkdir -p /home/user/app &&\
56
+ chmod -R 777 /home/user/app
57
+ # RUN mkdir -p /home/user/.cache/torch/sentence_transformers/sentence-transformers_all-MiniLM-L6-v2/.gitattributes.lock && \
58
+ # chmod -R u+rwx /home/user/.cache/torch/sentence_transformers/sentence-transformers_all-MiniLM-L6-v2/.gitattributes.lock
59
+
60
+
61
+ # RUN mkdir -p /home/user/.cache/torch && chmod -R u+rwx /home/user/.cache/torch
62
+ RUN mkdir -p /home/user/matplotlib && chmod -R u+rwx /home/user/matplotlib
63
+
64
+ RUN apt-get update
65
+ RUN apt-get install build-essential libssl-dev ca-certificates libasound2 wget
66
+ RUN apt-get install -y ffmpeg
67
+ RUN apt-get install -y graphviz
68
+
69
+ RUN python -m playwright install-deps
70
+ RUN PLAYWRIGHT_BROWSERS_PATH=/home/user/app/ms-playwright python -m playwright install chromium
71
+ # RUN apt-get update && \
72
+ # apt-get install -y build-essential libssl-dev ca-certificates libasound2 wget && \
73
+ # wget -O - https://www.openssl.org/source/openssl-1.1.1u.tar.gz | tar zxf - && \
74
+ # cd openssl-1.1.1u && \
75
+ # ./config --prefix=/usr/local && \
76
+ # make -j $(nproc) && \
77
+ # make install_sw install_ssldirs && \
78
+ # ldconfig -v && \
79
+ # export SSL_CERT_DIR=/etc/ssl/certs && \
80
+ # cd ../ && \
81
+ # rm -rf openssl-1.1.1u && \
82
+ # pip install --no-cache-dir azure-cognitiveservices-speech==1.30.0 \
83
+ # export SSL_CERT_DIR=/usr/lib/ssl/certs
84
+
85
+
86
+
87
+ # Set up a new user named "user" with user ID 1000
88
  RUN useradd -m -u 1000 user
89
+
90
+ # Switch to the "user" user
91
  USER user
 
 
92
 
93
+ # Set home to the user's home directory
94
+ ENV HOME=/home/user \
95
+ PATH=/home/user/.local/bin:$PATH
96
+
97
+ # RUN mkdir -p /home/user/.cache/torch && \
98
+ # chown -R user:user /home/user/.cache
99
+
100
+ # Set the working directory to the user's home directory
101
  WORKDIR $HOME/app
102
+
103
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
104
+ COPY --chown=user . $HOME/app
105
 
106
  EXPOSE 8501
107
+
108
  CMD streamlit run app.py \
109
  --server.headless true \
110
  --server.enableCORS false \