Skip to content

Instantly share code, notes, and snippets.

@code33
Forked from takaya030/Dockerfile
Created March 5, 2017 06:50
Show Gist options
  • Save code33/1b55edcdaf2edc5c3c41284b8291e589 to your computer and use it in GitHub Desktop.
Save code33/1b55edcdaf2edc5c3c41284b8291e589 to your computer and use it in GitHub Desktop.
Docker CentOS6 image with Python 2.7.11
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# git prompt
if [ -f $HOME/.git-completion.bash ]; then
source $HOME/.git-completion.bash
fi
if [ -f $HOME/.git-prompt.sh ]; then
source $HOME/.git-prompt.sh
export PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h\[\033[35m\]: \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
fi
# User specific aliases and functions
alias ls='ls -F --color=auto'
alias ll='ls -la --color=auto'
alias la='ls -a --color=auto'
alias sl='ls -F --color=auto'
alias glog='git log --oneline --decorate --graph --branches --tags --remotes'
#
# 2016/08/26
# CentOS 6.7 + epel,remi
# Python 2.7
#
FROM centos:6
MAINTAINER takaya030
# update yum
RUN yum update -y && \
yum clean all
# epel repo
RUN yum install -y epel-release && \
yum clean all
RUN sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/epel.repo
# remi repo
RUN yum install -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && \
yum clean all
RUN sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/remi.repo
## rpmforge repo
#RUN yum install -y http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm && \
# yum clean all
#RUN sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/rpmforge.repo
# mysql community repo
#RUN yum install -y http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm && \
# yum clean all
#RUN sed -i -e "s/enabled *= *1/enabled=0/g" /etc/yum.repos.d/mysql-community.repo
# gcc, make, sshd, scp, sudo, unzip, tar, which
RUN yum install -y gcc make openssh-server openssh-clients sudo tar unzip which && \
yum clean all
# libraries
RUN yum install -y bzip2-devel zlib-devel openssl-devel sqlite-devel ncurses-devel readline-devel tk-devel && \
yum clean all
# python
RUN curl -O https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz && \
tar xvzf Python-2.7.11.tgz && \
cd Python-2.7.11 && \
./configure --prefix=/opt/local && \
make && make altinstall && \
cd .. && \
rm -r Python-2.7.11 Python-2.7.11.tgz
# pip, easy_install
RUN curl -kL https://bootstrap.pypa.io/get-pip.py | /opt/local/bin/python2.7 && \
/opt/local/bin/pip2.7 install distribute
# for git prompt
RUN curl -L https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash > /etc/skel/.git-completion.bash && \
curl -L https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > /etc/skel/.git-prompt.sh
ADD ./bashrc /etc/skel/.bashrc
# initialize for ssh
RUN sed -i '/pam_loginuid\.so/s/required/optional/' /etc/pam.d/sshd
RUN /sbin/service sshd start
RUN /sbin/service sshd stop
# create login user
RUN useradd -d /home/gae -m -s /bin/bash gae
RUN echo gae:****gae | chpasswd
RUN echo 'gae ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# timezone
RUN cp -p /usr/share/zoneinfo/Japan /etc/localtime
# symbolic links
RUN ln -s /opt/local/bin/python2.7 /usr/bin/python2.7
EXPOSE 22
CMD ["/usr/sbin/sshd","-D"]
#
# 2016/08/26
# CentOS 6.7 + epel,remi
# Python 2.7.11
# PHP 5.5.31
# GAE SDK 1.9.31
FROM takaya030/python27
MAINTAINER takaya030
# libraries
RUN yum install -y libxml2-devel libxslt-devel libcurl-devel libpng-devel libicu-devel && \
yum clean all
RUN yum install --enablerepo=epel -y libmcrypt libmcrypt-devel libwebp && \
yum clean all
# php 5.5
RUN curl -Lso php-5.5.31.tar.gz http://jp2.php.net/get/php-5.5.31.tar.gz/from/this/mirror && \
tar xvzf php-5.5.31.tar.gz && \
cd php-5.5.31 && \
./configure --prefix=/usr/local/php-5.5.31/ \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-mbstring \
--enable-opcache \
--enable-phar \
--enable-soap \
--enable-sockets \
--enable-zip \
--disable-fileinfo \
--disable-flatfile \
--disable-posix \
--with-curl \
--with-gd \
--with-openssl \
--without-sqlite3 \
--without-pdo-sqlite \
--without-imap \
--without-kerberos \
--without-imap-ssl \
--without-interbase \
--without-ldap \
--without-mssql \
--without-oci8 \
--without-pgsql \
--without-pear \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql=mysqlnd \
--with-config-file-path=/etc && \
make && make install && \
cp ./php.ini-production /etc/php.ini && \
cd .. && \
rm -r php-5.5.31 php-5.5.31.tar.gz
# modify /etc/php.ini
RUN sed -i -e "s/;date.timezone *=.*$/date.timezone = Asia\/Tokyo/" /etc/php.ini
# symbolic links
RUN ln -s /usr/local/php-5.5.31/bin/php /usr/local/bin/php && \
ln -s /usr/local/php-5.5.31/bin/php-cgi /usr/local/bin/php-cgi && \
ln -s /usr/local/php-5.5.31/bin/php-config /usr/local/bin/php-config && \
ln -s /usr/local/php-5.5.31/bin/phpize /usr/local/bin/phpize
# Google App Engine SDK
RUN curl -O https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.31.zip && \
unzip google_appengine_1.9.31.zip -d /usr/local/ && \
rm google_appengine_1.9.31.zip
# modify gae scripts
RUN sed -i -e "s/\/usr\/bin\/env *python/\/usr\/bin\/env python2.7/" /usr/local/google_appengine/*.py
# composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# phpunit
RUN curl -L https://phar.phpunit.de/phpunit-old.phar > /usr/local/bin/phpunit && \
chmod +x /usr/local/bin/phpunit
# git
RUN yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker && \
yum clean all && \
curl -O https://www.kernel.org/pub/software/scm/git/git-2.9.3.tar.gz && \
tar xvzf git-2.9.3.tar.gz && \
cd git-2.9.3 && \
make configure && \
./configure --prefix=/usr/local && \
make all && \
make install && \
cd .. && \
rm -r git-2.9.3 git-2.9.3.tar.gz
EXPOSE 22 8080 8000
CMD ["/usr/sbin/sshd","-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment