Last active
August 29, 2015 14:19
-
-
Save spg/81388d750c713ec00370 to your computer and use it in GitHub Desktop.
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
FROM phusion/baseimage:0.9.16 | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
libreadline-gplv2-dev \ | |
libncursesw5-dev \ | |
libssl-dev \ | |
libsqlite3-dev \ | |
tk-dev libgdbm-dev \ | |
libc6-dev libbz2-dev | |
# ====== Python runtime ==================== | |
# http://bugs.python.org/issue19846# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. | |
ENV LANG C.UTF-8 | |
ENV PYTHON_VERSION 2.7.7 | |
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported | |
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF | |
RUN set -x \ | |
&& mkdir -p /usr/src/python \ | |
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ | |
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ | |
&& gpg --verify python.tar.xz.asc \ | |
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ | |
&& rm python.tar.xz* \ | |
&& cd /usr/src/python \ | |
&& ./configure --enable-shared --enable-unicode=ucs4 \ | |
&& make -j$(nproc) \ | |
&& make install \ | |
&& ldconfig \ | |
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ | |
&& find /usr/local \ | |
\( -type d -a -name test -o -name tests \) \ | |
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | |
-exec rm -rf '{}' + \ | |
&& rm -rf /usr/src/python | |
# ===================== Java ================ | |
# Install Java. | |
RUN \ | |
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ | |
add-apt-repository -y ppa:webupd8team/java && \ | |
apt-get update && \ | |
apt-get install -y oracle-java7-installer && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
rm -rf /var/cache/oracle-jdk7-installer | |
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle | |
# =============== Postgres ================= | |
# 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 apt-key adv --keyserver pool.sks-keyservers.net --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 | |
ENV PG_MAJOR 9.3 | |
ENV PG_VERSION 9.3.6-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 | |
RUN mkdir -p /var/lib/postgresql/data | |
# =================== Teamcity ============== | |
ENV TEAMCITY_DATA_PATH /data/teamcity | |
# Download and install TeamCity to /opt | |
RUN apt-get -y install tar wget | |
ENV TEAMCITY_PACKAGE TeamCity-8.1.5.tar.gz | |
ENV TEAMCITY_DOWNLOAD http://download.jetbrains.com/teamcity | |
RUN wget $TEAMCITY_DOWNLOAD/$TEAMCITY_PACKAGE && \ | |
tar zxf $TEAMCITY_PACKAGE -C /opt && \ | |
rm -rf $TEAMCITY_PACKAGE | |
EXPOSE 8111 | |
# =========== Other shit ============== | |
#required for running Teamcity's maintainDB.sh | |
RUN apt-get -y install perl | |
ADD https://jdbc.postgresql.org/download/postgresql-9.4-1201.jdbc4.jar $TEAMCITY_DATA_PATH/lib/jdbc/ | |
COPY database.properties / | |
RUN apt-get update && apt-get install -y git | |
RUN echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config | |
RUN ssh-keyscan -H github.com >> /root/.ssh/known_hosts | |
COPY requirements.txt /requirements.txt | |
RUN pip install -r /requirements.txt && rm /requirements.txt | |
COPY docker-entrypoint.sh / | |
COPY run-pg.sh /etc/service/pg/run | |
COPY watch_backups.sh /etc/service/watch_backups/run | |
COPY restore-backup.sh /restore-backup.sh | |
COPY restore_backup.py / | |
COPY boto_config /etc/boto.cfg | |
# this is a hack to work around https://github.com/phusion/baseimage-docker/issues/44 | |
CMD ["/sbin/my_init", "--", "/restore-backup.sh"] | |
# Clean up APT when done. | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment