Update dockerfile
Browse files- dockerfile +15 -1
dockerfile
CHANGED
@@ -1,16 +1,30 @@
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
|
|
4 |
FROM python:3.9
|
5 |
|
|
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
|
|
10 |
WORKDIR /app
|
11 |
|
|
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
|
|
15 |
COPY --chown=user . /app
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
+
# Use official Python image
|
5 |
FROM python:3.9
|
6 |
|
7 |
+
# Create a non-root user
|
8 |
RUN useradd -m -u 1000 user
|
9 |
USER user
|
10 |
ENV PATH="/home/user/.local/bin:$PATH"
|
11 |
|
12 |
+
# Set working directory
|
13 |
WORKDIR /app
|
14 |
|
15 |
+
# Copy and install dependencies
|
16 |
COPY --chown=user ./requirements.txt requirements.txt
|
17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
18 |
|
19 |
+
# Copy all project files
|
20 |
COPY --chown=user . /app
|
21 |
+
|
22 |
+
# Set environment variables for Flask
|
23 |
+
ENV FLASK_APP=src.app.app.py
|
24 |
+
ENV PYTHONPATH=/app/src:$PYTHONPATH
|
25 |
+
|
26 |
+
# Expose the Flask port
|
27 |
+
EXPOSE 7860
|
28 |
+
|
29 |
+
# Run Flask
|
30 |
+
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|