-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
52 lines (42 loc) · 1.34 KB
/
Dockerfile
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
# How to
# copy .env.model to .env and write your own OPEN_AI_KEY
# Run the following commands :
# make docker_build
# make docker_run
FROM python:3.10 as bunkatopicsbasedocker
ARG DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
python3-dev \
python3 \
python3-pip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# copying dependency
COPY bunkatopics /app/bunkatopics
# Rajouter variables environemment
ENV OPEN_AI_KEY=${OPEN_AI_KEY}
# Workspace
WORKDIR /app/api
# Python requirements (poetry has issues with fasttext: pybind11)
RUN pip install --upgrade pip
# Bunka libraries
COPY requirements.txt requirements.txt
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
######################################
# changing user & downloading models #
######################################
FROM bunkatopicsbasedocker
# Models
# RUN python -m spacy download en_core_web_sm
# reducing privilege
RUN groupadd rungroup && useradd -m -g rungroup runuser
RUN chown runuser:rungroup /app
USER runuser
# code
COPY --chown=runuser:rungroup api/run_server.sh run_server.sh
COPY --chown=runuser:rungroup api/bunka_api bunka_api
COPY --chown=runuser:rungroup api/celeryconfig.py celeryconfig.py
EXPOSE 8000
# start the server
CMD ["bash", "run_server.sh"]