parkkyujin commited on
Commit
15f557b
ยท
verified ยท
1 Parent(s): 07292ea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -7
Dockerfile CHANGED
@@ -1,4 +1,7 @@
1
  FROM python:3.9-slim
 
 
 
2
  WORKDIR /app
3
 
4
  RUN apt-get update && apt-get install -y \
@@ -11,17 +14,23 @@ RUN apt-get update && apt-get install -y \
11
  # 1. requirements.txt ๋ณต์‚ฌ (์ด ํŒŒ์ผ์—๋Š” numpy ๊ด€๋ จ ๋ผ์ธ์ด ์—†์Œ)
12
  COPY requirements.txt ./
13
 
14
- # 2. requirements.txt์— ๋ช…์‹œ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค ๋จผ์ € ์„ค์น˜
15
- RUN pip3 install --no-cache-dir -r requirements.txt
 
 
 
16
 
17
- # 3. Streamlit ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ (NumPy 2.0+ ํ˜ธํ™˜)
18
- RUN pip3 install --no-cache-dir --upgrade streamlit
19
 
20
- # 4. NumPy 2.0+ ์„ค์น˜ (์ž„๋ฒ ๋”ฉ ํŒŒ์ผ๊ณผ ํ˜ธํ™˜๋˜๋„๋ก)
21
- RUN pip3 install --no-cache-dir "numpy>=2.0.0"
 
 
22
 
23
- # 5. NumPy ์„ค์น˜ ๋ฐ ํ•ต์‹ฌ ๋ชจ๋“ˆ ์ž„ํฌํŠธ ํ™•์ธ
24
  RUN python -c "import numpy; print('NumPy version:', numpy.__version__)"
 
25
  RUN python -c "import numpy._core; print('Successfully imported numpy._core')" || \
26
  python -c "import numpy.core; print('Using numpy.core fallback')"
27
 
@@ -30,6 +39,16 @@ COPY streamlit_app.py ./
30
  COPY ๊ด‘๊ณ ์นดํ”ผ๋ฐ์ดํ„ฐ_๋ธŒ๋žœ๋“œ์ถ”์ถœ์™„๋ฃŒ.xlsx ./
31
  COPY copy_embeddings.pkl ./
32
 
 
 
 
 
 
 
 
 
 
 
33
  EXPOSE 8501
34
 
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
1
  FROM python:3.9-slim
2
+
3
+ # ๋น„ root ์‚ฌ์šฉ์ž ์ƒ์„ฑ ๋ฐ ๊ถŒํ•œ ์„ค์ •
4
+ RUN useradd -m -u 1000 streamlit
5
  WORKDIR /app
6
 
7
  RUN apt-get update && apt-get install -y \
 
14
  # 1. requirements.txt ๋ณต์‚ฌ (์ด ํŒŒ์ผ์—๋Š” numpy ๊ด€๋ จ ๋ผ์ธ์ด ์—†์Œ)
15
  COPY requirements.txt ./
16
 
17
+ # 2. ํ˜ธํ™˜๋˜๋Š” ํŒจํ‚ค์ง€ ๋ฒ„์ „๋“ค์„ ๋ชจ๋‘ ํ•จ๊ป˜ ์„ค์น˜
18
+ RUN pip3 install --no-cache-dir \
19
+ "numpy>=2.0.0" \
20
+ "pandas>=2.0.0" \
21
+ "streamlit>=1.35.0"
22
 
23
+ # 3. ๋‚˜๋จธ์ง€ requirements.txt์˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋“ค ์„ค์น˜
24
+ RUN pip3 install --no-cache-dir -r requirements.txt
25
 
26
+ # 4. Streamlit ์„ค์ • ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ ๋ฐ ๊ถŒํ•œ ์„ค์ •
27
+ RUN mkdir -p /home/streamlit/.streamlit && \
28
+ chown -R streamlit:streamlit /home/streamlit/.streamlit && \
29
+ chown -R streamlit:streamlit /app
30
 
31
+ # 5. NumPy ํ˜ธํ™˜์„ฑ ํ™•์ธ
32
  RUN python -c "import numpy; print('NumPy version:', numpy.__version__)"
33
+ RUN python -c "import pandas; print('Pandas version:', pandas.__version__)"
34
  RUN python -c "import numpy._core; print('Successfully imported numpy._core')" || \
35
  python -c "import numpy.core; print('Using numpy.core fallback')"
36
 
 
39
  COPY ๊ด‘๊ณ ์นดํ”ผ๋ฐ์ดํ„ฐ_๋ธŒ๋žœ๋“œ์ถ”์ถœ์™„๋ฃŒ.xlsx ./
40
  COPY copy_embeddings.pkl ./
41
 
42
+ # ๋ชจ๋“  ํŒŒ์ผ ๊ถŒํ•œ์„ streamlit ์‚ฌ์šฉ์ž์—๊ฒŒ ํ• ๋‹น
43
+ RUN chown -R streamlit:streamlit /app
44
+
45
+ # ๋น„ root ์‚ฌ์šฉ์ž๋กœ ์ „ํ™˜
46
+ USER streamlit
47
+
48
+ # Streamlit ์„ค์ •
49
+ ENV STREAMLIT_CONFIG_DIR=/home/streamlit/.streamlit
50
+ ENV HOME=/home/streamlit
51
+
52
  EXPOSE 8501
53
 
54
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health