-
Notifications
You must be signed in to change notification settings - Fork 21
/
flowdb_testdata.Dockerfile
50 lines (43 loc) · 1.87 KB
/
flowdb_testdata.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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# FLOWDB
# -----
#
# Extends the basic FlowDB image to include a small amount of test data.
#
ARG CODE_VERSION=latest
FROM flowminder/flowdb:${CODE_VERSION}
# Something causes a a hang if we don't do this: https://github.com/docker-library/postgres/discussions/1183#discussioncomment-10205585
ENV PAGER=cat
#
# Install pyenv to avoid being pinned to debian python
#
RUN apt update && apt install git -y --no-install-recommends && \
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
rm -rf /var/lib/apt/lists/* && \
apt-get purge -y --auto-remove
#
# Install python dependencies
#
COPY --chown=postgres flowdb/testdata/test_data/Pipfile* /docker-entrypoint-initdb.d/
USER postgres
RUN cd /docker-entrypoint-initdb.d/ && pipenv install --clear --deploy
USER root
#
# Add test data to the ingestion directory.
#
RUN mkdir -p \
/docker-entrypoint-initdb.d/sql/testdata/ \
/docker-entrypoint-initdb.d/py/testdata/
COPY --chown=postgres flowdb/testdata/bin/* /docker-entrypoint-initdb.d/
ADD --chown=postgres flowdb/testdata/test_data/sql/* /docker-entrypoint-initdb.d/sql/testdata/
ADD --chown=postgres flowdb/testdata/test_data/py/* /docker-entrypoint-initdb.d/py/testdata/
ADD --chown=postgres flowdb/testdata/test_data/data/ /docker-entrypoint-initdb.d/data/
COPY --chown=postgres flowdb/testdata/test_data/data/*.csv /docker-entrypoint-initdb.d/data/csv/
COPY --chown=postgres flowetl/flowetl/flowetl/qa_checks/qa_checks /docker-entrypoint-initdb.d/qa_checks
# Need to make postgres owner of any subdirectories
RUN chown -R postgres /docker-entrypoint-initdb.d
# Explicitly set number of days of dfs data to match test data
ENV N_DAYS=7