Skip to content

Instantly share code, notes, and snippets.

@klyushkov
Created November 10, 2016 14:26
Show Gist options
  • Save klyushkov/8289932cc3cedb2bb4db954e56c38181 to your computer and use it in GitHub Desktop.
Save klyushkov/8289932cc3cedb2bb4db954e56c38181 to your computer and use it in GitHub Desktop.
root@hosting2 /opt/stalker-build # cat Dockerfile
FROM phusion/baseimage:0.9.18
MAINTAINER Maksim Klyushkov <docker@trige.ru>
CMD ["/sbin/my_init"]
RUN apt-get update
RUN apt-get install -y \
apache2 \
nginx \
memcached \
php5 \
php5-mysql \
php-soap \
php5-intl \
php-gettext \
php5-memcache \
php5-curl \
php5-mysql \
php5-mcrypt \
php5-tidy \
php5-imagick \
php5-geoip \
php-pear \
npm \
nodejs \
upstart \
wget \
curl \
unzip \
mysql-client
RUN pear channel-discover pear.phing.info
RUN pear install -Z phing/phing
RUN echo "short_open_tag = On" >> /etc/php5/apache2/php.ini && a2enmod rewrite
RUN sed 's/80/88/g' -i /etc/apache2/ports.conf
COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf
COPY nginx_config /etc/nginx/sites-available/default
COPY 01_stalker.sh /etc/my_init.d/01_stalker.sh
COPY deploy.sh /opt/deploy.sh
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 80
root@hosting2 /opt/stalker-build #
root@hosting2 /opt/stalker-build #
root@hosting2 /opt/stalker-build # cat 000-default.conf
<VirtualHost *:88>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory /var/www/stalker_portal>
Options -Indexes -MultiViews
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
root@hosting2 /opt/stalker-build # cat nginx_config
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:88/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* \.(htm|html|jpeg|jpg|gif|png|css|js)$ {
root /var/www;
expires 30d;
}
}
root@hosting2 /opt/stalker-build # cat 01_stalker.sh
#!/bin/sh
service memcached start
service apache2 start
service nginx start
root@hosting2 /opt/stalker-build # cat deploy.sh
#!/bin/sh
STALKER="/var/www/stalker_portal"
if [ ! -d $STALKER/deploy ]; then
wget -O /tmp/stalker.zip https://github.com/azhurb/stalker_portal/archive/v5.0.3.zip
unzip /tmp/stalker.zip -d /var/www/
mv /var/www/stalker_portal-*/* /var/www/stalker_portal/
rm -rf /var/www/stalker_portal-*
fi
if [ ! -s $STALKER/server/custom.ini ]; then
wget -O $STALKER/server/custom.ini https://gist.githubusercontent.com/klyushkov/2dcec9f537458ff702cddf882e12eca5/raw/f3dc2c1a8d7a54d9710ba4d650a7a01e9da9a9b2/stalker_custom.ini
fi
sed -i '/\bmysql_tzinfo_to_sql\b/g' $STALKER/deploy/build.xml
cd $STALKER/deploy && phing
if [ $? -eq 1 ]; then
phing
fi
echo Success!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment