FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sgr/engine/Dockerfile.debug at master · splitgraph/sgr · GitHub
splitgraph
/
sgr
Public
Notifications
You must be signed in to change notification settings
Fork
19
Star
324
Code
Issues
19
Pull requests
35
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sgr
/
engine
/
Dockerfile.debug
Copy path
More file actions
More file actions
Latest commit
History
History
History
141 lines (109 loc) · 5.74 KB
Breadcrumbs
sgr
/
engine
/
Dockerfile.debug
Copy path
File metadata and controls
141 lines (109 loc) · 5.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# syntax = docker/dockerfile:experimental
# Multistage Dockerfile to build the Splitgraph engine with debugging capabilities.
# For now does not include MySQL and Mongo FDWs
# The underlying splitgraph/pg_debug:development image is built via
# Dockerfile.pg_debug, and the reason for this separation is so that we don't
# need to rebuild PG on every change in Multicorn/FDW instances.
#####
##### cstore_fdw and multicorn
#####
FROM splitgraph/pg_debug:development AS builder_cstore_multicorn
COPY ./engine/src/cstore_fdw /src/cstore_fdw
COPY ./engine/src/Multicorn /src/Multicorn
COPY ./engine/build_scripts/fdws/multicorn /build
COPY ./engine/build_scripts/fdws/cstore_fdw /build
RUN /build/build_cstore_fdw.sh
RUN /build/build_multicorn.sh
#####
##### splitgraph/engine
#####
FROM splitgraph/pg_debug:development
# We still have to install some runtime libraries here, but no dev.
RUN apt-get update -qq && \
apt-get install -y \
libprotobuf-c1 \
libpython3.7 \
postgresql-plpython3-12 && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3.7 get-pip.py && \
rm get-pip.py && \
rm -rf /var/lib/apt/lists/*
# Set locale to C instead of en-US, Postgres initdb breaks with default
# locale otherwise + we get build warnings for FDWs.
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# Install Splitgraph itself (required for layered querying)
RUN mkdir -p /var/lib/splitgraph/objects && chmod 777 /var/lib/splitgraph/objects
# Do the installation in two phases to use Docker caching: first,
# install all the dependencies and then copy the Splitgraph code over (way later in the build).
# That way, if we just change the code, we only need to rebuild one last layer rather than
# reinstall all dependencies from scratch. We also do dependency installation before
# copying over various FDW SOs, since those are cheaper to copy and can get rebuilt more often.
# However, we need to make Poetry think that we actually have a genuine package
# that we want to install in editable mode in here, so we create and copy some files to fool it.
RUN mkdir -p /splitgraph/splitgraph && touch /splitgraph/splitgraph/__init__.py
COPY poetry.lock pyproject.toml README.md /splitgraph/
COPY ./engine/build_scripts/build_splitgraph.sh /build/
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip /build/build_splitgraph.sh
# Extract and copy over all binaries from the builder stages
# This is slightly sad: whilst multicorn's make install respects DESTDIR,
# python setup.py doesn't and installs it to /usr/local.
# Since nothing else in here uses easy_install, we grab the .pth file and the unpacked egg.
COPY --from=builder_cstore_multicorn /output/root /
COPY --from=builder_cstore_multicorn \
/usr/local/lib/python3.7/dist-packages/easy-install.pth \
/usr/local/lib/python3.7/dist-packages/easy-install.pth
COPY --from=builder_cstore_multicorn \
/usr/local/lib/python3.7/dist-packages/multicorn-1.4.0.dev0-py3.7-linux-x86_64.egg \
/usr/local/lib/python3.7/dist-packages/multicorn-1.4.0.dev0-py3.7-linux-x86_64.egg
# Also copy over the source code for GDB to be able to print it while
# traversing through code, or e.g. executing the `list` command
COPY --from=builder_cstore_multicorn /src/Multicorn /src/Multicorn
COPY --from=builder_cstore_multicorn /src/cstore_fdw /src/cstore_fdw
# NB important: the plpython installation upgrades postgresql and overwrites our binaries,
# so we have to get them back.
COPY --from=splitgraph/pg_debug:development /usr/lib/postgresql/12/bin /usr/lib/postgresql/12/bin
COPY --from=splitgraph/pg_debug:development /usr/lib/postgresql/12/lib /usr/lib/postgresql/12/lib
RUN ldconfig
# Set up Postgres config files/envvars/init scripts
EXPOSE 5432
ENV POSTGRES_DB splitgraph
ENV POSTGRES_USER sgr
COPY ./engine/etc /etc/
COPY ./engine/init_scripts /docker-entrypoint-initdb.d/
# We don't install Mongo/MySQL extensions in the debug image
RUN sed -i '/\(mongo_fdw\|mysql_fdw\)/d' /docker-entrypoint-initdb.d/000_create_extensions.sql
# Copy the actual Splitgraph code over at this point.
COPY ./splitgraph /splitgraph/splitgraph
COPY ./bin /splitgraph/bin
# "Install" elasticsearch_fdw
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
mkdir /pg_es_fdw && \
pip install "elasticsearch>=7.7.0,<8.0"
COPY ./engine/src/postgres-elasticsearch-fdw/pg_es_fdw /pg_es_fdw/pg_es_fdw
# Install the Snowflake SQLAlchemy connector
# Use our fork that supports server-side cursors
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
pip install "git+https://github.com/splitgraph/snowflake-sqlalchemy.git@14e64cc0ef7374df0cecc91923ff6901b0d721b7"
# Install PyAthena for Amazon Athena SQLAlchemy-based FDW, as well as pandas
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
pip install "PyAthena>=2.4.1" && \
pip install "pandas>=1.0.0"
# Install Google's Big Query SQLAlchemy dialect lib
RUN --mount=type=cache,id=pip-cache,target=/root/.cache/pip \
pip install "sqlalchemy-bigquery"
ENV PATH "${PATH}:/splitgraph/bin"
ENV PYTHONPATH "${PYTHONPATH}:/splitgraph:/pg_es_fdw"
# https://github.com/postgis/docker-postgis/blob/master/12-3.2/Dockerfile
ARG with_postgis
RUN test -z "${with_postgis}" || (\
export POSTGIS_MAJOR=3 && \
export POSTGIS_VERSION=3.2.3+dfsg-1.pgdg100+1 && \
apt-get update \
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
&& apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
&& rm -rf /var/lib/apt/lists/* && \
echo "CREATE EXTENSION postgis;" >> /docker-entrypoint-initdb.d/000_create_extensions.sql)
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql_debug.conf"]
Back
|
FazBrowse Home
|
New Git URL