Dreipfelt commited on
Commit
ede6e69
·
verified ·
1 Parent(s): 3f7b9c1

non-root-user (#1)

Browse files

- 🔒️ Add a non root user (a54a6896da445df2fed77b91be37be24e0f86a1c)
- 🧱 Update docker image version (b8854ad1a70a455697f9bfd6c37aee35a0872ef6)

Files changed (3) hide show
  1. Dockerfile +12 -6
  2. README.md +1 -1
  3. src/{streamlit_app.py → app.py} +0 -0
Dockerfile CHANGED
@@ -1,6 +1,4 @@
1
- FROM python:3.9-slim
2
-
3
- WORKDIR /app
4
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
@@ -9,13 +7,21 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- COPY requirements.txt ./
13
- COPY src/ ./src/
 
 
 
 
14
 
 
15
  RUN pip3 install -r requirements.txt
16
 
 
 
 
17
  EXPOSE 8501
18
 
19
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
20
 
21
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ FROM python:3.13-slim
 
 
2
 
3
  RUN apt-get update && apt-get install -y \
4
  build-essential \
 
7
  git \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ RUN useradd -m -u 1000 user
11
+ USER user
12
+ ENV HOME=/home/user \
13
+ PATH=/home/user/.local/bin:$PATH
14
+
15
+ WORKDIR $HOME/app
16
 
17
+ COPY --chown=user requirements.txt ./
18
  RUN pip3 install -r requirements.txt
19
 
20
+ COPY --chown=user README.md ./
21
+ COPY --chown=user src/ ./src/
22
+
23
  EXPOSE 8501
24
 
25
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
26
 
27
+ ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
README.md CHANGED
@@ -13,7 +13,7 @@ short_description: Streamlit template space
13
 
14
  # Welcome to Streamlit!
15
 
16
- Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:
17
 
18
  If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
19
  forums](https://discuss.streamlit.io).
 
13
 
14
  # Welcome to Streamlit!
15
 
16
+ Edit `/src/app.py` to customize this app to your heart's desire. :heart:
17
 
18
  If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
19
  forums](https://discuss.streamlit.io).
src/{streamlit_app.py → app.py} RENAMED
File without changes