Spaces:
Sleeping
Sleeping
Add application file
Browse files- Dockerfile +14 -8
Dockerfile
CHANGED
@@ -1,27 +1,33 @@
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
|
|
4 |
USER user
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
7 |
WORKDIR /app
|
8 |
|
|
|
9 |
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
|
11 |
-
|
|
|
12 |
|
|
|
|
|
13 |
COPY --chown=user ./lib/better_profanity-2.0.0-py3-none-any.whl /lib/
|
14 |
-
|
15 |
COPY --chown=user ./lib/privacy-1.0.9-py3-none-any.whl /lib/
|
16 |
|
17 |
-
|
18 |
-
|
19 |
COPY --chown=user . /app
|
20 |
|
21 |
-
# Expose the
|
22 |
EXPOSE 7860
|
23 |
|
24 |
-
# CMD to run
|
25 |
-
CMD ["
|
26 |
-
|
27 |
|
|
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
# Create a non-root user to run the app
|
4 |
RUN useradd -m -u 1000 user
|
5 |
+
|
6 |
USER user
|
7 |
ENV PATH="/home/user/.local/bin:$PATH"
|
8 |
|
9 |
+
# Set the working directory inside the container
|
10 |
WORKDIR /app
|
11 |
|
12 |
+
# Copy the requirements file and install dependencies
|
13 |
COPY --chown=user ./requirements.txt requirements.txt
|
14 |
|
15 |
+
# Install the required Python libraries
|
16 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
17 |
|
18 |
+
# Copy custom libraries (if any)
|
19 |
+
COPY --chown=user ./lib/aicloudlibs-0.1.0-py3-none-any.whl /lib/
|
20 |
COPY --chown=user ./lib/better_profanity-2.0.0-py3-none-any.whl /lib/
|
|
|
21 |
COPY --chown=user ./lib/privacy-1.0.9-py3-none-any.whl /lib/
|
22 |
|
23 |
+
# Copy the app code into the container
|
|
|
24 |
COPY --chown=user . /app
|
25 |
|
26 |
+
# Expose port 7860 for the app (can be changed if needed)
|
27 |
EXPOSE 7860
|
28 |
|
29 |
+
# CMD to run Flask app with Gunicorn (recommended for production)
|
30 |
+
CMD ["gunicorn", "-w", "4", "main:app", "--bind", "0.0.0.0:7860"]
|
|
|
31 |
|
32 |
+
# Alternatively, for local development (uncomment the line below):
|
33 |
+
# CMD ["python", "main.py"]
|