shomez commited on
Commit
db6c99e
·
verified ·
1 Parent(s): 31c9d5a

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -9
Dockerfile CHANGED
@@ -6,7 +6,7 @@
6
 
7
  # Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
8
 
9
- ARG PYTHON_VERSION=3.10.4
10
  FROM python:${PYTHON_VERSION}-slim as base
11
 
12
  # Prevents Python from writing pyc files.
@@ -34,14 +34,16 @@ RUN adduser \
34
  # Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
35
  # Leverage a bind mount to requirements.txt to avoid having to copy them into
36
  # into this layer.
 
 
 
37
  RUN --mount=type=cache,target=/root/.cache/pip \
38
  --mount=type=bind,source=requirements.txt,target=requirements.txt \
39
  python -m pip install -r requirements.txt
40
 
41
- # Switch to the non-privileged user to run the application.
42
- USER appuser
43
 
44
  FROM base as dev
 
45
  ENV FLASK_APP=run.py
46
  ENV FLASK_DEBUG=true
47
  COPY . .
@@ -50,11 +52,7 @@ CMD flask run --host=0.0.0.0
50
 
51
 
52
  FROM base as prod
53
- # Copy the source code into the container.
54
  COPY . .
55
-
56
- # Expose the port that the application listens on.
57
  EXPOSE 5000
58
-
59
- # Run the application.
60
- CMD gunicorn 'run:app' --bind=0.0.0.0:5000
 
6
 
7
  # Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
8
 
9
+ ARG PYTHON_VERSION=3.10.12
10
  FROM python:${PYTHON_VERSION}-slim as base
11
 
12
  # Prevents Python from writing pyc files.
 
34
  # Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
35
  # Leverage a bind mount to requirements.txt to avoid having to copy them into
36
  # into this layer.
37
+ RUN --mount=type=cache,target=/root/.cache/pip \
38
+ python -m pip install torch==2.3.0 --index-url https://download.pytorch.org/whl/cpu
39
+
40
  RUN --mount=type=cache,target=/root/.cache/pip \
41
  --mount=type=bind,source=requirements.txt,target=requirements.txt \
42
  python -m pip install -r requirements.txt
43
 
 
 
44
 
45
  FROM base as dev
46
+ # ENV PYTHONPATH="${PYTHONPATH}:./api"
47
  ENV FLASK_APP=run.py
48
  ENV FLASK_DEBUG=true
49
  COPY . .
 
52
 
53
 
54
  FROM base as prod
 
55
  COPY . .
 
 
56
  EXPOSE 5000
57
+ # Switch to the non-privileged user to run the application.
58
+ CMD gunicorn --bind 0.0.0.0:5000 api.app:app --workers 1 --log-level info --access-logfile - --error-logfile -