-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:3.9.20-bookworm
# Show print logs; don't write .pyc files.
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Update the package list
RUN apt update
# Install Gunicorn for production image
RUN pip install gunicorn
# Install project dependencies
COPY requirements.txt /
RUN pip install --no-cache-dir -r /requirements.txt
# transformers 4.20.1 (from requirements.txt) has issues downloading models
# from Hugging Face. This higher version works, but it is incompatible with
# some other dependencies, so we install it here.
RUN pip install --no-cache-dir --upgrade transformers==4.35.0
# Copy the source code
COPY app /app
# Copy model weights
COPY model.tar.gz /app/model.tar.gz
# Set the working directory
WORKDIR /app
# Set application variables for Flask
ENV FLASK_APP=app.py
ENV FLASK_DEBUG=0
ENV MG_PARSER_PORT=32770
# Expose the port on which the application runs.
EXPOSE $MG_PARSER_PORT
# Shell form (instead of recommended JSON form) to allow variable expansion.
CMD flask run --host=0.0.0.0 --port=${MG_PARSER_PORT}