Skip to content

Commit

Permalink
Merge pull request openstates#4449 from johnseekins/fix-ca-container-…
Browse files Browse the repository at this point in the history
…build

Container build improvements
  • Loading branch information
johnseekins authored Feb 3, 2023
2 parents 63f6482 + 7c3eab0 commit ea85956
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENV PYTHONIOENCODING='utf-8'
ENV LANG='C.UTF-8'

RUN apt-get update -qq \
&& apt-get install -y -qq --no-install-recommends \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
ca-certificates \
curl \
wget \
Expand All @@ -32,7 +32,7 @@ RUN apt-get update -qq \
&& 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 \
&& apt-get install -y -qq --no-install-recommends gh
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends gh
RUN pip --no-cache-dir --disable-pip-version-check install wheel \
&& pip --no-cache-dir --disable-pip-version-check install crcmod poetry

Expand Down
11 changes: 8 additions & 3 deletions Dockerfile.california
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ENV PYTHONIOENCODING='utf-8'
ENV LANG='C.UTF-8'

RUN apt-get update -qq \
&& apt-get install -y -qq --no-install-recommends \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
curl \
wget \
unzip \
Expand All @@ -33,12 +33,17 @@ RUN apt-get update -qq \
&& 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 \
&& apt-get install -y -qq --no-install-recommends gh
&& 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

Expand All @@ -58,4 +63,4 @@ RUN poetry install --extras "california" \

ENV OPENSSL_CONF=/opt/openstates/openstates/openssl.cnf

ENTRYPOINT ["poetry", "run", "os-update"]
ENTRYPOINT ["/entrypoint.sh"]
11 changes: 11 additions & 0 deletions scrapers/ca/ca-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [[ -z $1 ]]; then
echo "Missing argument for scrape type"
exit 1
fi
set -e

mysqld --user root --max_allowed_packet=512M &
/opt/openstates/openstates/scrapers/ca/download.sh
poetry run os-update ca $1

0 comments on commit ea85956

Please sign in to comment.