Simplify Dockerfile and add minimal test app
Browse files- Dockerfile +10 -22
- simple_test.py +17 -0
Dockerfile
CHANGED
|
@@ -1,10 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM python:3.
|
| 3 |
-
|
| 4 |
-
# Install system dependencies
|
| 5 |
-
RUN apt-get update && apt-get install -y \
|
| 6 |
-
ffmpeg \
|
| 7 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
# Set up a new user named "user" with user ID 1000
|
| 10 |
RUN useradd -m -u 1000 user
|
|
@@ -17,23 +12,16 @@ ENV HOME=/home/user \
|
|
| 17 |
PATH=/home/user/.local/bin:$PATH
|
| 18 |
|
| 19 |
# Set the working directory
|
| 20 |
-
WORKDIR
|
| 21 |
-
|
| 22 |
-
# Copy requirements first for better caching
|
| 23 |
-
COPY --chown=user requirements.txt .
|
| 24 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
# Set environment variables
|
| 30 |
-
ENV PYTHONUNBUFFERED=1 \
|
| 31 |
-
PYTHONDONTWRITEBYTECODE=1 \
|
| 32 |
-
PORT=7860
|
| 33 |
|
| 34 |
# Expose the port Streamlit will run on
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# Simple Dockerfile for Hugging Face Spaces
|
| 2 |
+
FROM python:3.9-slim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Set up a new user named "user" with user ID 1000
|
| 5 |
RUN useradd -m -u 1000 user
|
|
|
|
| 12 |
PATH=/home/user/.local/bin:$PATH
|
| 13 |
|
| 14 |
# Set the working directory
|
| 15 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Install streamlit
|
| 18 |
+
RUN pip install --no-cache-dir streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Expose the port Streamlit will run on
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
+
# Copy the simple test file
|
| 24 |
+
COPY --chown=user simple_test.py /app/
|
| 25 |
+
|
| 26 |
+
# Command to run the simple test app
|
| 27 |
+
CMD ["streamlit", "run", "--server.port", "7860", "--server.address", "0.0.0.0", "simple_test.py"]
|
simple_test.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.title("Simple Test App")
|
| 4 |
+
st.write("If you can see this, the app is working!")
|
| 5 |
+
st.write("This is a minimal test to verify Streamlit functionality.")
|
| 6 |
+
|
| 7 |
+
# Display some basic system info
|
| 8 |
+
import sys
|
| 9 |
+
import platform
|
| 10 |
+
|
| 11 |
+
st.subheader("System Information")
|
| 12 |
+
st.write(f"Python version: {sys.version}")
|
| 13 |
+
st.write(f"Platform: {platform.platform()}")
|
| 14 |
+
|
| 15 |
+
# Add a simple interactive element
|
| 16 |
+
if st.button("Click me!"):
|
| 17 |
+
st.success("Button clicked!")
|