Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +15 -22
Dockerfile
CHANGED
|
@@ -1,42 +1,35 @@
|
|
| 1 |
-
# Use the official Python image as the base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Install essential build tools
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
curl \
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# Set up a new user named "user" with user ID 1000
|
| 12 |
RUN useradd -m -u 1000 user
|
| 13 |
|
| 14 |
-
# Switch to the "user" user
|
| 15 |
USER user
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
PATH=/home/user/.local/bin:$PATH
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
-
# Copy
|
| 28 |
-
# Use the --chown flag to ensure the copied files are owned by the user
|
| 29 |
COPY --chown=user requirements.txt $HOME/app/
|
| 30 |
COPY --chown=user app.py $HOME/app/
|
| 31 |
-
COPY --chown=user ./src/ $HOME/app/
|
| 32 |
|
| 33 |
-
# Install
|
|
|
|
| 34 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# Use the user's home directory as the working directory
|
| 39 |
-
WORKDIR $HOME/app
|
| 40 |
-
|
| 41 |
-
# Run your app. Adjust the command if your app starts differently.
|
| 42 |
-
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
build-essential \
|
| 5 |
curl \
|
| 6 |
git \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
|
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
|
|
|
|
| 11 |
USER user
|
| 12 |
+
ENV HOME=/home/user
|
| 13 |
+
WORKDIR $HOME/app
|
| 14 |
|
| 15 |
+
# Create github_repo directory and ensure it's owned by `user`
|
| 16 |
+
RUN mkdir -p $HOME/app/github_repo
|
|
|
|
| 17 |
|
| 18 |
+
# Ensure the Dockerfile has the appropriate steps before this to set up git if needed
|
| 19 |
+
# For example, setting up git config or credentials if the repository is private
|
| 20 |
|
| 21 |
+
# Clone the repository into the created github_repo directory
|
| 22 |
+
# You might need to adjust the permissions or use git through SSH keys depending on your setup
|
| 23 |
+
# RUN git clone <repository-URL> $HOME/app/github_repo/
|
| 24 |
|
| 25 |
+
# Copy application files
|
|
|
|
| 26 |
COPY --chown=user requirements.txt $HOME/app/
|
| 27 |
COPY --chown=user app.py $HOME/app/
|
| 28 |
+
COPY --chown=user ./src/ $HOME/app/src/
|
| 29 |
|
| 30 |
+
# Install dependencies
|
| 31 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 32 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
+
# The service runs on port 7860
|
| 35 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|