-
Notifications
You must be signed in to change notification settings - Fork 468
/
Dockerfile.california
66 lines (58 loc) · 2.29 KB
/
Dockerfile.california
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
56
57
58
59
60
61
62
63
64
65
66
FROM python:3.9-slim
LABEL maintainer="James Turk <dev@jamesturk.net>"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONIOENCODING='utf-8'
ENV LANG='C.UTF-8'
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
curl \
wget \
unzip \
mdbtools \
libpq5 \
libgdal32 \
libmariadb-dev \
mariadb-server \
mariadb-client \
build-essential \
git \
libssl-dev \
libffi-dev \
freetds-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
poppler-utils \
libpq-dev \
libgdal-dev \
libgeos-dev \
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list \
&& apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends gh
# add mysql configs once so we don't have to do them at every instantiation
RUN sed -i "s/user = mysql/user = root/" /etc/mysql/mariadb.conf.d/50-server.cnf \
&& mysql_install_db --user=root \
&& mkdir /run/mysqld
RUN pip --no-cache-dir --disable-pip-version-check install wheel \
&& pip --no-cache-dir --disable-pip-version-check install crcmod poetry
ADD poetry.lock /opt/openstates/openstates/
ADD pyproject.toml /opt/openstates/openstates/
ADD scrapers/ca/ca-entrypoint.sh /ca-entrypoint.sh
WORKDIR /opt/openstates/openstates/
ENV PYTHONPATH=./scrapers
RUN poetry install --no-root
ADD . /opt/openstates/openstates/
# the last step cleans out temporarily downloaded artifacts for poetry, shrinking our build
RUN poetry install --extras "california" \
&& rm -r /root/.cache/pypoetry/cache /root/.cache/pypoetry/artifacts/ \
&& apt-get remove -y -qq \
build-essential \
libpq-dev \
&& apt-get autoremove -y -qq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV OPENSSL_CONF=/opt/openstates/openstates/openssl.cnf
ENTRYPOINT ["/ca-entrypoint.sh"]