Spaces:
Sleeping
Sleeping
Cam commited on
Commit ·
e4ed074
1
Parent(s): 4d6e8c2
Adjust docker file
Browse files- Dockerfile +18 -3
- setup.py +1 -1
Dockerfile
CHANGED
|
@@ -13,9 +13,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 13 |
EXPOSE 7860
|
| 14 |
|
| 15 |
# 5. Create a startup script that will configure guardrails and start the app
|
|
|
|
| 16 |
RUN echo '#!/bin/bash\n\
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
\n\
|
| 20 |
if [ ! -z "$GUARDRAILS_API_KEY" ]; then\n\
|
| 21 |
echo "Configuring Guardrails with API key..."\n\
|
|
@@ -24,7 +26,20 @@ else\n\
|
|
| 24 |
echo "Warning: GUARDRAILS_API_KEY environment variable is not set."\n\
|
| 25 |
fi\n\
|
| 26 |
\n\
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
' > /app/startup.sh
|
| 29 |
|
| 30 |
# Make the startup script executable
|
|
|
|
| 13 |
EXPOSE 7860
|
| 14 |
|
| 15 |
# 5. Create a startup script that will configure guardrails and start the app
|
| 16 |
+
# Use the home directory instead of /root
|
| 17 |
RUN echo '#!/bin/bash\n\
|
| 18 |
+
# Create config in HOME directory instead of /root\n\
|
| 19 |
+
mkdir -p $HOME/.guardrails\n\
|
| 20 |
+
echo "{\"api_key\": \"$GUARDRAILS_API_KEY\", \"telemetry\": false, \"remote\": false}" > $HOME/.guardrails/config.json\n\
|
| 21 |
\n\
|
| 22 |
if [ ! -z "$GUARDRAILS_API_KEY" ]; then\n\
|
| 23 |
echo "Configuring Guardrails with API key..."\n\
|
|
|
|
| 26 |
echo "Warning: GUARDRAILS_API_KEY environment variable is not set."\n\
|
| 27 |
fi\n\
|
| 28 |
\n\
|
| 29 |
+
# List all Python files to help debug\n\
|
| 30 |
+
echo "Available Python files:"\n\
|
| 31 |
+
find /app -name "*.py" -type f\n\
|
| 32 |
+
\n\
|
| 33 |
+
# Try to find the main Streamlit app file\n\
|
| 34 |
+
STREAMLIT_APP=$(find /app -name "*.py" -type f | grep -i "app\|main\|streamlit" | head -1)\n\
|
| 35 |
+
\n\
|
| 36 |
+
if [ -z "$STREAMLIT_APP" ]; then\n\
|
| 37 |
+
echo "Error: Could not find a Streamlit app file. Please make sure your Streamlit file exists."\n\
|
| 38 |
+
exit 1\n\
|
| 39 |
+
fi\n\
|
| 40 |
+
\n\
|
| 41 |
+
echo "Starting Streamlit with: $STREAMLIT_APP"\n\
|
| 42 |
+
exec streamlit run $STREAMLIT_APP --server.port 7860 --server.address 0.0.0.0\n\
|
| 43 |
' > /app/startup.sh
|
| 44 |
|
| 45 |
# Make the startup script executable
|
setup.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from setuptools import setup, find_packages
|
| 2 |
|
| 3 |
# Read requirements
|
| 4 |
-
with open('
|
| 5 |
requirements = f.read().splitlines()
|
| 6 |
|
| 7 |
setup(
|
|
|
|
| 1 |
from setuptools import setup, find_packages
|
| 2 |
|
| 3 |
# Read requirements
|
| 4 |
+
with open('requirements.txt') as f:
|
| 5 |
requirements = f.read().splitlines()
|
| 6 |
|
| 7 |
setup(
|