Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -6
Dockerfile
CHANGED
@@ -3,16 +3,18 @@ FROM python:3.10
|
|
3 |
# Install fakeroot and set up user
|
4 |
RUN apt-get update && apt-get install -y fakeroot && \
|
5 |
mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
6 |
-
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
|
7 |
chmod +x /usr/bin/apt-get && \
|
8 |
rm -rf /var/lib/apt/lists/* && \
|
9 |
useradd -m -u 1000 user
|
10 |
|
|
|
11 |
COPY --chown=1000:1000 --from=root / /
|
12 |
|
|
|
13 |
WORKDIR /home/user/app
|
14 |
|
15 |
-
# Install dependencies
|
16 |
RUN apt-get update && apt-get install -y \
|
17 |
git \
|
18 |
git-lfs \
|
@@ -23,8 +25,8 @@ RUN apt-get update && apt-get install -y \
|
|
23 |
rsync \
|
24 |
libgl1 \
|
25 |
libglx-mesa0 \
|
26 |
-
|
27 |
-
|
28 |
|
29 |
# Copy application code
|
30 |
COPY --chown=1000:1000 ./app /home/user/app
|
@@ -33,6 +35,8 @@ COPY --chown=1000:1000 ./app /home/user/app
|
|
33 |
COPY --chown=1000:1000 requirements.txt /home/user/app/
|
34 |
RUN pip install --no-cache-dir -r requirements.txt
|
35 |
|
36 |
-
# Run
|
37 |
USER user
|
38 |
-
|
|
|
|
|
|
3 |
# Install fakeroot and set up user
|
4 |
RUN apt-get update && apt-get install -y fakeroot && \
|
5 |
mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
6 |
+
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get "$@"' > /usr/bin/apt-get && \
|
7 |
chmod +x /usr/bin/apt-get && \
|
8 |
rm -rf /var/lib/apt/lists/* && \
|
9 |
useradd -m -u 1000 user
|
10 |
|
11 |
+
# Copy root filesystem
|
12 |
COPY --chown=1000:1000 --from=root / /
|
13 |
|
14 |
+
# Set workdir
|
15 |
WORKDIR /home/user/app
|
16 |
|
17 |
+
# Install dependencies (replacing deprecated libgl1-mesa-glx)
|
18 |
RUN apt-get update && apt-get install -y \
|
19 |
git \
|
20 |
git-lfs \
|
|
|
25 |
rsync \
|
26 |
libgl1 \
|
27 |
libglx-mesa0 \
|
28 |
+
&& rm -rf /var/lib/apt/lists/* \
|
29 |
+
&& git lfs install
|
30 |
|
31 |
# Copy application code
|
32 |
COPY --chown=1000:1000 ./app /home/user/app
|
|
|
35 |
COPY --chown=1000:1000 requirements.txt /home/user/app/
|
36 |
RUN pip install --no-cache-dir -r requirements.txt
|
37 |
|
38 |
+
# Run as non-root user
|
39 |
USER user
|
40 |
+
|
41 |
+
# Start the app
|
42 |
+
CMD ["python", "optimized_diet_plan_complete.py"]
|