Skip to content

Conversation

tianon
Copy link
Member

@tianon tianon commented Nov 3, 2016

Closes #119
Closes #210

ncopa and others added 4 commits November 3, 2016 12:44
…where we differ) and add all versions (including "update.sh" and "generate-stackbrew-library.sh" changes, with our new template)
@tianon
Copy link
Member Author

tianon commented Nov 3, 2016

a9c1b15#diff-c33c01a10da0304c608b5fa6ba3e9f9e is an easy place to see the changes added against #119

@tianon
Copy link
Member Author

tianon commented Nov 3, 2016

$ ./generate-stackbrew-library.sh # this file is generated via https://github.com/docker-library/postgres/blob/a9c1b15a7adf7cb2bc42fac776656aff7dd7994e/generate-stackbrew-library.sh Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),  Joseph Ferguson <yosifkit@gmail.com> (@yosifkit) GitRepo: https://github.com/docker-library/postgres.git Tags: 9.6.1, 9.6, 9, latest GitCommit: e4942cb0f79b61024963dc0ac196375b26fa60dd Directory: 9.6 Tags: 9.6.1-alpine, 9.6-alpine, 9-alpine, alpine GitCommit: a9c1b15a7adf7cb2bc42fac776656aff7dd7994e Directory: 9.6/alpine Tags: 9.5.5, 9.5 GitCommit: db63c8c4eff2aa81c3f2c9e42f1ede447c7cf99c Directory: 9.5 Tags: 9.5.5-alpine, 9.5-alpine GitCommit: a9c1b15a7adf7cb2bc42fac776656aff7dd7994e Directory: 9.5/alpine Tags: 9.4.10, 9.4 GitCommit: 56b1a0c47ae8361eca133e41c6ddd68ad492ac2d Directory: 9.4 Tags: 9.4.10-alpine, 9.4-alpine GitCommit: a9c1b15a7adf7cb2bc42fac776656aff7dd7994e Directory: 9.4/alpine Tags: 9.3.15, 9.3 GitCommit: 570ca9e8ea81cb6da73ea765132755f277cd0b66 Directory: 9.3 Tags: 9.3.15-alpine, 9.3-alpine GitCommit: a9c1b15a7adf7cb2bc42fac776656aff7dd7994e Directory: 9.3/alpine Tags: 9.2.19, 9.2 GitCommit: c01405b7c324350cc796ba9e861326aee158f75e Directory: 9.2 Tags: 9.2.19-alpine, 9.2-alpine GitCommit: a9c1b15a7adf7cb2bc42fac776656aff7dd7994e Directory: 9.2/alpine
@tianon
Copy link
Member Author

tianon commented Nov 3, 2016

$ ./update.sh + cp docker-entrypoint.sh 9.2/ + sed 's/%%PG_MAJOR%%/9.2/g; s/%%PG_VERSION%%/9.2.19-1.pgdg80+1/g' Dockerfile-debian.template + cp docker-entrypoint.sh 9.2/alpine/ + sed -i s/gosu/su-exec/g 9.2/alpine/docker-entrypoint.sh + sed 's/%%PG_MAJOR%%/9.2/g; s/%%PG_VERSION%%/9.2.19/g; s/%%PG_SHA256%%/1d29d73a4f590fcc348280f13ac2ff6a0f72c94908c54e3c20b7ab1560e8dbad/g' Dockerfile-alpine.template + cp docker-entrypoint.sh 9.3/ + sed 's/%%PG_MAJOR%%/9.3/g; s/%%PG_VERSION%%/9.3.15-1.pgdg80+1/g' Dockerfile-debian.template + cp docker-entrypoint.sh 9.3/alpine/ + sed -i s/gosu/su-exec/g 9.3/alpine/docker-entrypoint.sh + sed 's/%%PG_MAJOR%%/9.3/g; s/%%PG_VERSION%%/9.3.15/g; s/%%PG_SHA256%%/a9fcba1446a93aa95e3e1b6535756f0472d10b0f267a0845f8b2b29f89de5c4f/g' Dockerfile-alpine.template + cp docker-entrypoint.sh 9.4/ + sed 's/%%PG_MAJOR%%/9.4/g; s/%%PG_VERSION%%/9.4.10-1.pgdg80+1/g' Dockerfile-debian.template + cp docker-entrypoint.sh 9.4/alpine/ + sed -i s/gosu/su-exec/g 9.4/alpine/docker-entrypoint.sh + sed 's/%%PG_MAJOR%%/9.4/g; s/%%PG_VERSION%%/9.4.10/g; s/%%PG_SHA256%%/7061678bed1981c681ce54c76b98b6ec17743f090a9775104a45e7e1a8826ecf/g' Dockerfile-alpine.template + cp docker-entrypoint.sh 9.5/ + sed 's/%%PG_MAJOR%%/9.5/g; s/%%PG_VERSION%%/9.5.5-1.pgdg80+1/g' Dockerfile-debian.template + cp docker-entrypoint.sh 9.5/alpine/ + sed -i s/gosu/su-exec/g 9.5/alpine/docker-entrypoint.sh + sed 's/%%PG_MAJOR%%/9.5/g; s/%%PG_VERSION%%/9.5.5/g; s/%%PG_SHA256%%/02c65290be74de6604c3fed87c9fd3e6b32e949f0ab8105a75bd7ed5aa71f394/g' Dockerfile-alpine.template + cp docker-entrypoint.sh 9.6/ + sed 's/%%PG_MAJOR%%/9.6/g; s/%%PG_VERSION%%/9.6.1-1.pgdg80+1/g' Dockerfile-debian.template + cp docker-entrypoint.sh 9.6/alpine/ + sed -i s/gosu/su-exec/g 9.6/alpine/docker-entrypoint.sh + sed 's/%%PG_MAJOR%%/9.6/g; s/%%PG_VERSION%%/9.6.1/g; s/%%PG_SHA256%%/e5101e0a49141fc12a7018c6dad594694d3a3325f5ab71e93e0e51bd94e51fcd/g' Dockerfile-alpine.template
@tianon
Copy link
Member Author

tianon commented Nov 3, 2016

Looks like tests are failing due to missing tzdata; working on a fix now.

@yosifkit
Copy link
Member

yosifkit commented Nov 8, 2016

Diff between debian and alpine Dockerfile. They are very different since apt vs souce build, but they keep same flow.

diff --git a/Dockerfile-debian.template b/Dockerfile-alpine.template index 83eb859..c51348b 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-alpine.template @@ -1,49 +1,114 @@ # vim:set ft=dockerfile: -FROM debian:jessie - -# explicitly set user/group IDs -RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres - -# grab gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y --auto-remove ca-certificates wget +FROM alpine:3.4 + +# alpine includes "postgres" user/group in base install +# /etc/passwd:22:postgres:x:70:70::/var/lib/postgresql:/bin/sh +# /etc/group:34:postgres:x:70: + +# su-exec (gosu-compatible) is installed further down # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +# alpine doesn't require explicit locale-file generation ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 - ENV PG_MAJOR %%PG_MAJOR%% ENV PG_VERSION %%PG_VERSION%% +ENV PG_SHA256 %%PG_SHA256%% -RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list - -RUN apt-get update \ - && apt-get install -y postgresql-common \ - && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \ - && apt-get install -y \ - postgresql-$PG_MAJOR=$PG_VERSION \ - postgresql-contrib-$PG_MAJOR=$PG_VERSION \ - && rm -rf /var/lib/apt/lists/* +RUN set -ex \ + \ + && apk add --no-cache --virtual .fetch-deps \ + ca-certificates \ + openssl \ + tar \ + \ + && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ + && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ + && 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 \ + flex \ + gcc \ +# krb5-dev \ + libc-dev \ + libedit-dev \ + libxml2-dev \ + libxslt-dev \ + make \ +# openldap-dev \ + openssl-dev \ + perl \ +# perl-dev \ +# python-dev \ +# python3-dev \ +# tcl-dev \ + util-linux-dev \ + zlib-dev \ + \ + && cd /usr/src/postgresql \ +# configure options taken from: +# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 + && ./configure \ +# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" +# --enable-nls \ + --enable-integer-datetimes \ + --enable-thread-safety \ + --enable-tap-tests \ +# skip debugging info -- we want tiny size instead +# --enable-debug \ + --disable-rpath \ + --with-uuid=e2fs \ + --with-gnu-ld \ + --with-pgport=5432 \ + --with-system-tzdata=/usr/share/zoneinfo \ + --prefix=/usr/local \ + \ +# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :) +# --with-krb5 \ +# --with-gssapi \ +# --with-ldap \ +# --with-tcl \ +# --with-perl \ +# --with-python \ +# --with-pam \ + --with-openssl \ + --with-libxml \ + --with-libxslt \ + && make -j "$(getconf _NPROCESSORS_ONLN)" world \ + && make install-world \ + && make -C contrib install \ + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --no-cache --virtual .postgresql-rundeps \ + $runDeps \ + bash \ + su-exec \ +# tzdata loading functionality is optional, and fails gracefully +# tzdata \ + && apk del .fetch-deps .build-deps \ + && cd / \ + && rm -rf \ + /usr/src/postgresql \ + /usr/local/include/* \ + && find /usr/local -name '*.a' -delete # make the sample config easier to munge (and "correct by default") -RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \ - && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \ - && sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample +RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql 
@yosifkit yosifkit merged commit 03f4064 into docker-library:master Nov 8, 2016
@yosifkit
Copy link
Member

yosifkit commented Nov 8, 2016

We'll probably make/merge the PR to official-images tomorrow.

@yosifkit yosifkit deleted the alpine branch November 8, 2016 00:27
tianon added a commit to infosiftr/stackbrew that referenced this pull request Nov 14, 2016
- `bash`: 4.4, patch level 5 - `cassandra`: add `jemalloc` (docker-library/cassandra#87) - `java`: debian 9~b144-1 - `logstash`: update config for stdout logs (docker-library/logstash#67) - `mongo`: 3.4.0-rc3, reduce `windowsservercore` image size (docker-library/mongo#120) - `openjdk`: debian 9~b144-1 - `owncloud`: 8.0.16, 8.1.11, 8.2.9, 9.0.6, 9.1.2 - `php`: 5.6.28, 7.0.13, 7.1.0RC6 - `piwik`: 2.17.1, add `opcache` (matomo-org/docker#44) - `postgres`: add `alpine` variants (docker-library/postgres#216) - `pypy`: 5.6.0 - `tomcat`: switch from `unstable` to `stretch` for `openssl` (docker-library/tomcat#56)
@yosifkit yosifkit mentioned this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants