Skip to content

Instantly share code, notes, and snippets.

@memorycraft
Last active August 29, 2015 13:56
Show Gist options
  • Save memorycraft/9175045 to your computer and use it in GitHub Desktop.
Save memorycraft/9175045 to your computer and use it in GitHub Desktop.
# centosがベース
FROM centos
# 作成者
MAINTAINER memorycraft
# yumでいろいろインストール
RUN yum install sudo passwd openssh openssh-clients openssh-server httpd vim python-setuptools php php-devel php-mysql php-mbstring php-gd -y
# sshdの設定
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
# キーの生成
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
# sshでログインするユーザーを用意
RUN useradd memorycraft
RUN echo 'memorycraft:memorycraft_password' | chpasswd
RUN echo 'memorycraft ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/memorycraft
# wordpress
RUN curl http://ja.wordpress.org/wordpress-3.8.1-ja.tar.gz | tar -xz -C /var/www
RUN mv /var/www/html /var/www/html.org
RUN mv /var/www/wordpress /var/www/html
RUN cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
RUN sed -ri 's/database_name_here/memorycraft/g' /var/www/html/wp-config.php
RUN sed -ri 's/username_here/memorycraft_user/g' /var/www/html/wp-config.php
RUN sed -ri 's/password_here/memorycraft_pass/g' /var/www/html/wp-config.php
RUN sed -ri 's/localhost/memorycraft.xxxxxxxxxxxxx.ap-northeast-1.rds.amazonaws.com/g' /var/www/html/wp-config.php
# supervisordのインストール
RUN easy_install supervisor
# supervisordの設定
RUN echo_supervisord_conf > /etc/supervisord.conf
RUN echo '[include]' >> /etc/supervisord.conf
RUN echo 'files = supervisord/conf/*.conf' >> /etc/supervisord.conf
RUN mkdir -p /etc/supervisord/conf/
ADD supervisor.conf /etc/supervisord/conf/service.conf
# ポート開放
EXPOSE 22 80
# 起動時にsupervisordを実行
CMD ["/usr/bin/supervisord"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment