-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathDockerfile
144 lines (131 loc) · 3.76 KB
/
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
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
142
143
144
ARG ALPINE_VERSION="3.12"
FROM alpine:${ALPINE_VERSION}
ARG PG_MAJOR="13.0"
ARG PG_VERSION="13.0"
ARG GOSU_VERSION="1.12"
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Minimal PostgreSQL image based on Alpine Linux" \
org.label-schema.description="Minimal PostgreSQL image based on Alpine Linux" \
org.label-schema.url="https://github.com/onjin/docker-alpine-postgres" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/onjin/docker-alpine-postgres" \
org.label-schema.vendor="Marek Wywiał" \
org.label-schema.version=$PG_VERSION \
org.label-schema.schema-version="1.0"
ENV PATH /usr/lib/postgresql/${PG_MAJOR}/bin:$PATH
ENV PGDATA /var/lib/postgresql/data
ENV LANG en_US.utf8
RUN set -eux; \
addgroup -g 70 -S postgres; \
adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
mkdir -p /var/lib/postgresql; \
chown -R postgres:postgres /var/lib/postgresql
# echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \
RUN set -eux; \
\
wget -O postgresql.tar.bz2 https://ftp.postgresql.org/pub/source/v${PG_VERSION}/postgresql-${PG_VERSION}.tar.bz2 ; \
mkdir -p /usr/src/postgresql; \
tar \
--extract \
--file postgresql.tar.bz2 \
--directory /usr/src/postgresql \
--strip-components 1 \
; \
rm postgresql.tar.bz2; \
\
apk add --no-cache --virtual .build-deps \
bison \
coreutils \
dpkg-dev dpkg \
flex \
gcc \
# krb5-dev \
libc-dev \
libedit-dev \
libxml2-dev \
libxslt-dev \
linux-headers \
llvm10-dev clang g++ \
make \
# openldap-dev \
openssl-dev \
# configure: error: prove not found
perl-utils \
# configure: error: Perl module IPC::Run is required to run TAP tests
perl-ipc-run \
# perl-dev \
# python-dev \
# python3-dev \
# tcl-dev \
util-linux-dev \
zlib-dev \
icu-dev \
;\
\
mkdir -p /docker-entrypoint-initdb.d ; \
cd /usr/src/postgresql ; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-tap-tests \
--disable-rpath \
--with-uuid=e2fs \
--with-gnu-ld \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
--with-openssl \
--with-libxml \
--with-libxslt \
--with-icu \
--with-llvm\
;\
make world ; \
make install-world ; \
make -C contrib install ;\
cd /usr/src/postgresql/contrib ;\
make ;\
make install \
; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .postgresql-rundeps \
$runDeps \
bash \
tzdata \
;\
apk del --no-network .build-deps; \
cd /; \
rm -rf \
/usr/src/postgresql \
/usr/local/share/doc \
/usr/local/share/man \
; \
\
postgres --version \
; \
apk add gnupg ; \
gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 ; \
gpg --list-keys --fingerprint --with-colons | sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' | gpg --import-ownertrust ; \
wget -O /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64 ; \
wget -O /usr/local/bin/gosu.asc https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc ; \
gpg --verify /usr/local/bin/gosu.asc ; \
rm /usr/local/bin/gosu.asc ; \
chmod +x /usr/local/bin/gosu
VOLUME /var/lib/postgresql/data
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
STOPSIGNAL SIGINT
EXPOSE 5432
CMD ["postgres"]
#vim: set ft=dockerfile: