-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Dockerfile
39 lines (28 loc) · 1.05 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
# Stage 1: Compile image
FROM python:3.10-slim-bullseye AS compile-image
WORKDIR /app
RUN apt-get update && \
apt-get install --no-install-recommends -y wget libpq-dev gcc g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
RUN python3.10 -c "import nltk; nltk.download('punkt')" && \
python3.10 -c "import nltk; nltk.download('averaged_perceptron_tagger')"
COPY . .
RUN chmod +x ./entrypoint.sh ./wait-for-it.sh ./install_tool_dependencies.sh ./entrypoint_celery.sh
# Stage 2: Build image
FROM python:3.10-slim-bullseye AS build-image
WORKDIR /app
RUN apt-get update && \
apt-get install --no-install-recommends -y libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=compile-image /opt/venv /opt/venv
COPY --from=compile-image /app /app
COPY --from=compile-image /root/nltk_data /root/nltk_data
ENV PATH="/opt/venv/bin:$PATH"
EXPOSE 8001