File size: 1,371 Bytes
071e4c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

# # Fill in the base image with the correct Python version (e.g., python:3.9)
# #FROM ________
# FROM python:3.9-slim

# # Fill in the username to be created (e.g., user)
# RUN useradd -m -u 1000 ________

# # Blank #3: Specify the username for subsequent commands (e.g., user)
# USER ________

# # Fill in the username in the PATH environment variable (e.g., user)
# ENV PATH="/home/________/.local/bin:$PATH"

# # Set working directory
# WORKDIR /app

# # Use the same username for file ownership when copying requirements (e.g., user)
# COPY --chown=________ ./requirements.txt requirements.txt
# RUN pip install --no-cache-dir --upgrade -r requirements.txt

# # Use the same username for file ownership when copying the app files (e.g., user)
# COPY --chown=________ . /app

# # Start the Streamlit app on port 7860, the default port expected by Spaces
# CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]

# # Reference: https://huggingface.co/docs/hub/en/spaces-sdks-docker

FROM python:3.9-slim

RUN useradd -m -u 1000 appuser
USER appuser
ENV PATH="/home/appuser/.local/bin:$PATH"

WORKDIR /app
COPY --chown=appuser ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

COPY --chown=appuser . /app

CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]