Created
June 27, 2015 21:24
-
-
Save frobs/7e25f194549a74772b8f to your computer and use it in GitHub Desktop.
A example Dockerfile for Postgres 2.4 downloded from https://registry.hub.docker.com/_/postgres/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:set ft=dockerfile: | |
FROM debian:wheezy | |
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | |
RUN groupadd -r postgres && useradd -r -g postgres postgres | |
# grab gosu for easy step-down from root | |
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | |
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \ | |
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ | |
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ | |
&& gpg --verify /usr/local/bin/gosu.asc \ | |
&& rm /usr/local/bin/gosu.asc \ | |
&& chmod +x /usr/local/bin/gosu \ | |
&& apt-get purge -y --auto-remove curl | |
# 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 | |
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 9.4 | |
ENV PG_VERSION 9.4.4-1.pgdg70+1 | |
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-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 mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql | |
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH | |
ENV PGDATA /var/lib/postgresql/data | |
VOLUME /var/lib/postgresql/data | |
COPY docker-entrypoint.sh / | |
ENTRYPOINT ["/docker-entrypoint.sh"] | |
EXPOSE 5432 | |
CMD ["postgres"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment