FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sgr/engine/Dockerfile.pg_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.pg_debug
Copy path
More file actions
More file actions
Latest commit
History
History
History
109 lines (102 loc) · 3.78 KB
Breadcrumbs
sgr
/
engine
/
Dockerfile.pg_debug
Copy path
File metadata and controls
109 lines (102 loc) · 3.78 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
# syntax = docker/dockerfile:1.3-labs
# Base PostgreSQL debug image, where we compile and install it from source with
# full debugging capabilities. For more details see:
# https://wiki.postgresql.org/wiki/Developer_FAQ#Compile-time
# Note that we use the pre-built PG image from:
# https://github.com/docker-library/postgres/blob/master/12/bullseye/Dockerfile
# and just swap out the binaries and shared libs with the ones installed below.
#####
##### toolchain
#####
FROM postgres:12.3
# Compile and install PG in debug mode
ARG use_valgrind
RUN rm -rf /usr/lib/postgresql/12/* && \
apt-get update -qq && \
apt-get install -y --allow-downgrades \
build-essential \
curl \
wget \
git \
vim \
libssl-dev \
libsasl2-dev \
pkgconf \
autoconf \
libtool \
# https://github.com/docker-library/postgres/issues/678#issuecomment-586888013
postgresql-server-dev-$PG_MAJOR \
protobuf-c-compiler \
libprotobuf-c-dev \
libpython3.7-dev \
python3.7 \
python3-setuptools \
cmake \
clang-7 \
# Debugging tools
sudo \
gdb \
procps \
# PG source installation reqs
bison \
flex \
build-essential \
libreadline-dev \
libffi6-dbg \
libgcc1-dbg \
libkrb5-dbg \
libstdc++6-8-dbg \
libxml2-dbg \
zlib1g-dbg \
zlib1g \
zlib1g-dev \
xsltproc \
libxml2-utils && \
rm -rf /var/lib/apt/lists/* && \
# pgprint command for GDB
git clone https://github.com/tvesely/gdbpg.git && \
# Download PG source
git clone -b REL_12_STABLE https://github.com/postgres/postgres.git && \
# Download Valgrind source, compile and install
test -z "${use_valgrind}" || (\
# Make a switcheroo in the image entrypoint, so that instead of starting plain
# postgres we start it under Valgrind
sed -i -e 's/"$BASH_SOURCE"/"$BASH_SOURCE" valgrind --leak-check=full --show-leak-kinds=definite,indirect \
--num-callers=25 --log-file=\/pg-valgrind\/valgrind-%p.log --trace-children=yes \
--gen-suppressions=all --suppressions=postgres\/src\/tools\/valgrind.supp \
--suppressions=valgrind-python.supp --verbose --time-stamp=yes \
--error-markers=VALGRINDERROR-BEGIN,VALGRINDERROR-END/' /usr/local/bin/docker-entrypoint.sh && \
# Configure PG with Valgrind support
sed -i -e 's=/\*\s#define\sUSE_VALGRIND\s\*/=#define USE_VALGRIND=' postgres/src/include/pg_config_manual.h && \
# Download Python Valgrind suppressions and make folder for output files
curl https://svn.python.org/projects/python/trunk/Misc/valgrind-python.supp --output valgrind-python.supp && \
mkdir -p /pg-valgrind && sudo chmod a+w /pg-valgrind && \
# Build Valgrind
curl https://sourceware.org/pub/valgrind/valgrind-3.18.1.tar.bz2 --output valgrind-3.18.1.tar.bz2 && \
tar xf valgrind-3.18.1.tar.bz2 && \
cd valgrind-3.18.1 && \
./configure && \
make && \
make install && \
cd ..) && \
# Compile and install PG from source
cd /postgres && \
mkdir -p /usr/lib/postgresql/12 && \
./configure \
--enable-cassert \
--enable-debug \
CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" \
-prefix=/usr/lib/postgresql/12 && \
make && \
make install
# Extensions are not installed automatically; install extensions so that
# we can step through them in GDB (but otherwise they work fine without this).
# cd contrib && \
# make all && \
# make install
# Configure GDB: enable pgprint, disable confirmation and dynamic load prompt
COPY <<EOF /etc/gdb/gdbinit
source /gdbpg/gdbpg.py
set confirm off
set breakpoint pending on
EOF
Back
|
FazBrowse Home
|
New Git URL