Spaces:
Sleeping
Sleeping
fahmiaziz98
commited on
Commit
·
87c0653
1
Parent(s):
067c765
refactor dockerfile 3 fix permission user non root
Browse files- Dockerfile +10 -15
Dockerfile
CHANGED
@@ -11,19 +11,13 @@ COPY requirements.txt .
|
|
11 |
|
12 |
RUN pip install --upgrade pip && pip wheel --no-cache-dir --wheel-dir /wheels -r requirements.txt
|
13 |
|
14 |
-
|
15 |
FROM python:3.11.11-slim AS final
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
ENV PIP_DEFAULT_TIMEOUT=100 \
|
20 |
-
PYTHONUNBUFFERED=1 \
|
21 |
-
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
22 |
-
PIP_NO_CACHE_DIR=1
|
23 |
|
24 |
RUN set -ex \
|
25 |
&& addgroup --system --gid 1001 appgroup \
|
26 |
-
&& adduser --system --uid 1001 --gid 1001 --
|
27 |
&& apt-get update \
|
28 |
&& apt-get upgrade -y \
|
29 |
&& apt-get install -y libjpeg-dev zlib1g-dev \
|
@@ -33,16 +27,17 @@ RUN set -ex \
|
|
33 |
&& apt-get clean -y \
|
34 |
&& rm -rf /var/lib/apt/lists/*
|
35 |
|
36 |
-
|
37 |
-
RUN pip install -r requirements.txt
|
38 |
|
39 |
-
COPY
|
40 |
-
COPY
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
45 |
|
46 |
-
|
47 |
|
|
|
|
|
48 |
|
|
|
11 |
|
12 |
RUN pip install --upgrade pip && pip wheel --no-cache-dir --wheel-dir /wheels -r requirements.txt
|
13 |
|
|
|
14 |
FROM python:3.11.11-slim AS final
|
15 |
|
16 |
+
ENV PATH="/home/appuser/.local/bin:$PATH"
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
RUN set -ex \
|
19 |
&& addgroup --system --gid 1001 appgroup \
|
20 |
+
&& adduser --system --uid 1001 --gid 1001 --home /home/appuser appuser \
|
21 |
&& apt-get update \
|
22 |
&& apt-get upgrade -y \
|
23 |
&& apt-get install -y libjpeg-dev zlib1g-dev \
|
|
|
27 |
&& apt-get clean -y \
|
28 |
&& rm -rf /var/lib/apt/lists/*
|
29 |
|
30 |
+
WORKDIR /app
|
|
|
31 |
|
32 |
+
COPY --from=build /wheels /wheels
|
33 |
+
COPY requirements.txt .
|
34 |
|
35 |
+
RUN pip install --no-cache-dir --no-warn-script-location --no-index --find-links=/wheels -r requirements.txt
|
36 |
|
37 |
+
COPY . .
|
38 |
|
39 |
+
USER appuser
|
40 |
|
41 |
+
EXPOSE 7860
|
42 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
43 |
|