Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.45 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (40 loc) · 1.45 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11
WORKDIR /app
COPY ./api/middleware /app/api/middleware
COPY ./api/pipeline /app/api/pipeline
COPY ./api/router /app/api/router
COPY ./api/schemas /app/api/schemas
COPY ./api/custom_response.py /app/api/custom_response.py
COPY ./api/download_model.py /app/api/download_model.py
COPY ./api/requirements.txt /app/api/requirements.txt
RUN if [ -f models ]; then \
cp models /app/models; \
else \
true; \
fi
COPY ../server.py /app/server.py
COPY static /app/static
COPY templates /app/templates
COPY ../entrypoint.sh /app/entrypoint.sh
RUN apt-get update && \
apt-get install -y \
build-essential \
python3-dev \
python3-setuptools \
gcc \
make \
wget
WORKDIR /app
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --no-cache-dir -r /app/api/requirements.txt
RUN if [ ! -d /app/models ]; then \
mkdir -p /app/models && \
wget -O /app/models/replit-v2-codeinstruct-3b.q4_1.bin https://huggingface.co/abacaj/Replit-v2-CodeInstruct-3B-ggml/resolve/main/replit-v2-codeinstruct-3b.q4_1.bin; \
fi
RUN apt-get remove -y --purge make gcc build-essential \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV CPU_THREADS=$(nproc)
ENV WORKERS=$((CPU_THREADS*2+1))
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--worker-connections", "1000","--timeout", "10000", "server:app"]