Spaces:
Paused
Paused
KunalThakare279
commited on
Update Dockerfile
Browse files- Dockerfile +38 -2
Dockerfile
CHANGED
@@ -1,2 +1,38 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ARG PYTHON_VERSION=3.10
|
2 |
+
FROM python:${PYTHON_VERSION}-slim as base
|
3 |
+
|
4 |
+
# Prevents Python from writing pyc files.
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
+
|
7 |
+
ENV PYTHONUNBUFFERED=1
|
8 |
+
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
ARG UID=10001
|
12 |
+
RUN adduser \
|
13 |
+
--disabled-password \
|
14 |
+
--gecos "" \
|
15 |
+
--home "/nonexistent" \
|
16 |
+
--shell "/sbin/nologin" \
|
17 |
+
--no-create-home \
|
18 |
+
--uid "${UID}" \
|
19 |
+
appuser
|
20 |
+
|
21 |
+
RUN --mount=type=cache,target=/root/.cache/pip \
|
22 |
+
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
23 |
+
python -m pip install -r requirements.txt
|
24 |
+
|
25 |
+
# Switch to the non-privileged user to run the application.
|
26 |
+
USER appuser
|
27 |
+
|
28 |
+
# Copy the source code into the container.
|
29 |
+
COPY . .
|
30 |
+
COPY . .env
|
31 |
+
|
32 |
+
# Expose the port that the application listens on.
|
33 |
+
EXPOSE 8000
|
34 |
+
|
35 |
+
|
36 |
+
# Run the application.
|
37 |
+
ENTRYPOINT ["gunicorn", "app:app"]
|
38 |
+
CMD ["-b", "0.0.0.0:7860"]
|