Spaces:
Sleeping
Sleeping
Claude Code commited on
Commit ·
46c2524
1
Parent(s): f9972a0
Claude Code: Fix Dockerfile - set WORKDIR to /app and align paths
Browse files- Change WORKDIR from /data to /app in Dockerfile
- Update COPY destinations to /app/
- Update ENTRYPOINT to /app/entrypoint.sh
- Add cd /app in entrypoint.sh before starting uvicorn
- Fix logs directory path to /app/logs
Co-Authored-By: Claude Code
- Dockerfile +11 -11
- entrypoint.sh +4 -1
Dockerfile
CHANGED
|
@@ -6,27 +6,27 @@ LABEL space_id="tao-shen/HuggingClaw-Cain"
|
|
| 6 |
LABEL sdk="docker"
|
| 7 |
LABEL port="7860"
|
| 8 |
|
| 9 |
-
# Create /
|
| 10 |
-
RUN mkdir -p /data && chmod 777 /data
|
| 11 |
-
WORKDIR /
|
| 12 |
|
| 13 |
# Copy requirements and install (layer cache optimization)
|
| 14 |
COPY requirements.txt /tmp/
|
| 15 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 16 |
|
| 17 |
# Copy all application files - combined layer for faster builds
|
| 18 |
-
COPY app.py error_handlers.py entrypoint.sh openclaw.json /
|
| 19 |
-
COPY openclaw/ /
|
| 20 |
-
COPY static/ /
|
| 21 |
-
COPY frontend/ /
|
| 22 |
|
| 23 |
# Create necessary directories with proper permissions
|
| 24 |
-
RUN mkdir -p /
|
| 25 |
-
chmod +x /
|
| 26 |
-
chmod 777 /
|
| 27 |
|
| 28 |
ENV PORT=7860
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
# Use entrypoint for better startup logging
|
| 32 |
-
ENTRYPOINT ["/
|
|
|
|
| 6 |
LABEL sdk="docker"
|
| 7 |
LABEL port="7860"
|
| 8 |
|
| 9 |
+
# Create /app directory for application and /data for persistent storage
|
| 10 |
+
RUN mkdir -p /app /data && chmod 777 /data
|
| 11 |
+
WORKDIR /app
|
| 12 |
|
| 13 |
# Copy requirements and install (layer cache optimization)
|
| 14 |
COPY requirements.txt /tmp/
|
| 15 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 16 |
|
| 17 |
# Copy all application files - combined layer for faster builds
|
| 18 |
+
COPY app.py error_handlers.py entrypoint.sh openclaw.json /app/
|
| 19 |
+
COPY openclaw/ /app/openclaw/
|
| 20 |
+
COPY static/ /app/static/
|
| 21 |
+
COPY frontend/ /app/frontend/
|
| 22 |
|
| 23 |
# Create necessary directories with proper permissions
|
| 24 |
+
RUN mkdir -p /app/logs /app/.openclaw && \
|
| 25 |
+
chmod +x /app/entrypoint.sh && \
|
| 26 |
+
chmod 777 /app/logs /app/.openclaw
|
| 27 |
|
| 28 |
ENV PORT=7860
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
# Use entrypoint for better startup logging
|
| 32 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|
entrypoint.sh
CHANGED
|
@@ -11,6 +11,9 @@ echo "Working Directory: $(pwd)"
|
|
| 11 |
echo "Python Version: $(python --version)"
|
| 12 |
echo "=========================================="
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Verify app.py exists
|
| 15 |
if [ ! -f "/app/app.py" ]; then
|
| 16 |
echo "ERROR: app.py not found in /app"
|
|
@@ -24,7 +27,7 @@ echo "Files in /app:"
|
|
| 24 |
ls -la /app/*.py 2>/dev/null || echo " (no .py files in /app root)"
|
| 25 |
|
| 26 |
# Create logs directory
|
| 27 |
-
mkdir -p /
|
| 28 |
|
| 29 |
echo ""
|
| 30 |
echo "=========================================="
|
|
|
|
| 11 |
echo "Python Version: $(python --version)"
|
| 12 |
echo "=========================================="
|
| 13 |
|
| 14 |
+
# Change to app directory
|
| 15 |
+
cd /app
|
| 16 |
+
|
| 17 |
# Verify app.py exists
|
| 18 |
if [ ! -f "/app/app.py" ]; then
|
| 19 |
echo "ERROR: app.py not found in /app"
|
|
|
|
| 27 |
ls -la /app/*.py 2>/dev/null || echo " (no .py files in /app root)"
|
| 28 |
|
| 29 |
# Create logs directory
|
| 30 |
+
mkdir -p /app/logs
|
| 31 |
|
| 32 |
echo ""
|
| 33 |
echo "=========================================="
|