TimWindecker commited on
Commit
0f98158
·
verified ·
1 Parent(s): f6e7b75

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -16
Dockerfile CHANGED
@@ -1,7 +1,16 @@
1
  FROM python:3.13.5-slim
2
 
3
- WORKDIR /app
 
4
 
 
 
 
 
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  curl \
@@ -10,22 +19,22 @@ RUN apt-get update && apt-get install -y \
10
  nginx \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- COPY requirements.txt ./
14
- COPY src/ ./src/
15
- #COPY data/ ./data/
16
- #COPY results/ ./results/
17
- COPY nginx.conf /etc/nginx/nginx.conf
18
- COPY start.sh ./
19
- RUN chmod +x /app/start.sh
20
 
21
- RUN pip3 install -r requirements.txt
 
22
 
23
- EXPOSE 8501
 
 
24
 
25
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
 
 
26
 
27
- #CMD streamlit run src/streamlit_app.py --server.port 8502 --server.address 0.0.0.0 & \
28
- # uvicorn src.api_server:api --host 0.0.0.0 --port 8000 & \
29
- # nginx -g "daemon off;"
30
- ENTRYPOINT ["./start.sh"]
31
- #ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.13.5-slim
2
 
3
+ # Create non-root user
4
+ RUN useradd -m -u 1000 user
5
 
6
+ ENV HOME=/home/user \
7
+ PATH=/home/user/.local/bin:$PATH
8
+ WORKDIR $HOME/app
9
+
10
+ # Switch to root
11
+ USER root
12
+
13
+ # Install dependencies
14
  RUN apt-get update && apt-get install -y \
15
  build-essential \
16
  curl \
 
19
  nginx \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Fix nginx permissions
23
+ RUN mkdir -p /var/cache/nginx /var/log/nginx /var/lib/nginx && \
24
+ touch /var/run/nginx.pid && \
25
+ chown -R user:user /var/cache/nginx /var/log/nginx /var/lib/nginx /var/run/nginx.pid
 
 
 
26
 
27
+ # Switch to user
28
+ USER user
29
 
30
+ # Install Python dependencies
31
+ COPY --chown=user requirements.txt ./
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
 
34
+ # Copy code and config
35
+ COPY --chown=user nginx.conf /etc/nginx/sites-available/default
36
+ COPY --chown=user run.sh /home/user/app/run.sh
37
+ COPY --chown=user src /home/user/app/src
38
 
39
+ EXPOSE 8501
40
+ CMD ["bash", "run.sh"]