Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Establish base working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Transfer project files into container workspace
|
| 8 |
+
COPY . .
|
| 9 |
+
|
| 10 |
+
# Install dependencies required by the application
|
| 11 |
+
RUN pip3 install -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Create a non-root user for better container security
|
| 14 |
+
RUN useradd -m -u 1000 appuser
|
| 15 |
+
|
| 16 |
+
# Switch execution context to newly created user
|
| 17 |
+
USER appuser
|
| 18 |
+
|
| 19 |
+
# Configure home directory and update PATH
|
| 20 |
+
ENV HOME=/home/appuser PATH=/home/appuser/.local/bin:$PATH
|
| 21 |
+
|
| 22 |
+
# Change working directory to user's app folder
|
| 23 |
+
WORKDIR $HOME/app
|
| 24 |
+
|
| 25 |
+
# Copy project files with correct ownership
|
| 26 |
+
COPY --chown=appuser . $HOME/app
|
| 27 |
+
|
| 28 |
+
# Launch Streamlit server with external accessibility
|
| 29 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|