forked from alephdata/aleph
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
51 lines (40 loc) · 1.8 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
FROM python:3.12-slim
ENV DEBIAN_FRONTEND noninteractive
LABEL org.opencontainers.image.source = "https://github.com/investigativedata/aleph"
# build-essential
RUN apt-get -qq -y update \
&& apt-get -qq --no-install-recommends -y install locales \
ca-certificates postgresql-client libpq-dev curl jq unzip git \
python3-pip python3-icu python3-psycopg2 \
python3-lxml python3-cryptography \
&& apt-get -qq -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
RUN apt-get clean && apt-get autoremove
ENV LANG='en_US.UTF-8'
RUN groupadd -g 1000 -r app \
&& useradd -m -u 1000 -s /bin/false -g app app
# Add ftm-compare model data
ADD ./contrib/glm_bernoulli_2e_wf-v0.4.1.pkl /opt/ftm-compare/model.pkl
ADD ./contrib/word_frequencies-v0.4.1.zip /opt/ftm-compare/word-frequencies/word-frequencies.zip
RUN python3 -m zipfile --extract /opt/ftm-compare/word-frequencies/word-frequencies.zip /opt/ftm-compare/word-frequencies/
# Install Python dependencies
RUN pip3 install --no-cache-dir -q -U pip setuptools six lxml lxml_html_clean
COPY requirements.txt /tmp/
RUN pip3 install --no-cache-dir -q -r /tmp/requirements.txt
# Install aleph
COPY . /aleph
WORKDIR /aleph
ENV PYTHONPATH /aleph
RUN pip install --no-cache-dir -q -e /aleph
# Configure some docker defaults:
ENV FTM_COMPARE_FREQUENCIES_DIR=/opt/ftm-compare/word-frequencies/ \
FTM_COMPARE_MODEL=/opt/ftm-compare/model.pkl
RUN mkdir /run/prometheus
COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY docker-entrypoint.d /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
# Run the green unicorn
CMD gunicorn --config /aleph/gunicorn.conf.py --workers 6 --log-level info --log-file -