Spaces:
Running
Running
Trisha Tomy
commited on
Commit
·
b25c42e
1
Parent(s):
c894916
updated dockerfile
Browse files- Dockerfile +13 -30
Dockerfile
CHANGED
@@ -8,31 +8,23 @@ WORKDIR /app
|
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
git \
|
10 |
xvfb \
|
|
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
# Copy
|
14 |
-
# These are now at the root of your local Git repo
|
15 |
COPY requirements.txt .
|
16 |
-
|
17 |
-
# Copy your Flask app.py to the root of /app
|
18 |
-
# This is also now at the root of your local Git repo
|
19 |
COPY app.py .
|
20 |
|
21 |
-
# Copy the entire '
|
22 |
-
# This
|
23 |
-
COPY proxy-lite-demo-v2
|
24 |
|
25 |
-
# Copy
|
26 |
-
|
27 |
-
COPY proxy-lite-demo-v2/gifs/ /app/proxy-lite-demo-v2/gifs/
|
28 |
-
COPY proxy-lite-demo-v2/screenshots/ /app/proxy-lite-demo-v2/screenshots/
|
29 |
-
# Add other top-level files from proxy-lite-demo-v2 if your app references them directly
|
30 |
-
COPY proxy-lite-demo-v2/README.md .
|
31 |
-
# And other directories like proxy-lite-work if your app uses them
|
32 |
-
COPY proxy-lite-work /app/proxy-lite-work
|
33 |
|
34 |
-
#
|
35 |
-
|
|
|
36 |
|
37 |
# --- START: Directory permission workaround ---
|
38 |
# Create the directory proxy-lite's recorder insists on writing to
|
@@ -46,17 +38,8 @@ RUN mkdir -p /app/local_trajectories \
|
|
46 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
47 |
|
48 |
# Install your local proxy-lite package in editable mode.
|
49 |
-
#
|
50 |
-
#
|
51 |
-
# you might need to adjust this, but for now, this assumes it's within /app/src/
|
52 |
-
# If 'pip install -e .' expects it at the root of the original project,
|
53 |
-
# we need to be careful here. Let's make it explicit if it's a sub-package.
|
54 |
-
# From your original commit log: create mode 100644 proxy-lite-demo-v2/pyproject.toml
|
55 |
-
# This means proxy-lite itself might be defined by pyproject.toml at the *sub-root*.
|
56 |
-
# So, for 'pip install -e .', the '.' would need to point to /app/proxy-lite-demo-v2.
|
57 |
-
# Let's adjust this.
|
58 |
-
|
59 |
-
# Install the proxy_lite package from its expected location inside the container
|
60 |
RUN pip install --no-cache-dir --no-input -e /app/proxy-lite-demo-v2
|
61 |
|
62 |
# Install the rest of the Python dependencies from requirements.txt
|
@@ -78,5 +61,5 @@ RUN echo "-----------------------------------"
|
|
78 |
EXPOSE 7860
|
79 |
|
80 |
# Define the command to run your Flask application using Gunicorn for production.
|
81 |
-
# This
|
82 |
CMD exec gunicorn --bind 0.0.0.0:7860 --workers 2 --worker-class gevent app:app --timeout 300
|
|
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
git \
|
10 |
xvfb \
|
11 |
+
# Clean up apt caches to reduce image size
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Copy essential files from the repo root to /app in the container
|
|
|
15 |
COPY requirements.txt .
|
|
|
|
|
|
|
16 |
COPY app.py .
|
17 |
|
18 |
+
# Copy the entire 'proxy-lite-demo-v2' directory into /app/proxy-lite-demo-v2
|
19 |
+
# This will ensure src, pyproject.toml, etc., are in their original nested structure within the container.
|
20 |
+
COPY proxy-lite-demo-v2 /app/proxy-lite-demo-v2/
|
21 |
|
22 |
+
# Copy the 'proxy-lite-work' directory if it's needed by the app
|
23 |
+
COPY proxy-lite-work /app/proxy-lite-work/
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
# --- IMPORTANT: Add proxy-lite-demo-v2/src to PYTHONPATH ---
|
26 |
+
# This is crucial so that 'app.py' (now at /app) can find 'from proxy_lite import ...'
|
27 |
+
ENV PYTHONPATH=/app/proxy-lite-demo-v2/src:$PYTHONPATH
|
28 |
|
29 |
# --- START: Directory permission workaround ---
|
30 |
# Create the directory proxy-lite's recorder insists on writing to
|
|
|
38 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
39 |
|
40 |
# Install your local proxy-lite package in editable mode.
|
41 |
+
# Now that proxy-lite-demo-v2 (containing pyproject.toml and src/) is at /app/proxy-lite-demo-v2,
|
42 |
+
# we explicitly tell pip to install from that directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
RUN pip install --no-cache-dir --no-input -e /app/proxy-lite-demo-v2
|
44 |
|
45 |
# Install the rest of the Python dependencies from requirements.txt
|
|
|
61 |
EXPOSE 7860
|
62 |
|
63 |
# Define the command to run your Flask application using Gunicorn for production.
|
64 |
+
# This assumes app.py is at the root of /app, which is true because we copied it there.
|
65 |
CMD exec gunicorn --bind 0.0.0.0:7860 --workers 2 --worker-class gevent app:app --timeout 300
|