Commit a5bfd15e by Tsubasa Namiki

Deploy app into docker image

parent f0e91ffd
......@@ -42,16 +42,15 @@ Password: restya
Change Restyaboard Version
------------------------------
Edit docker-compose.yml.
See https://github.com/RestyaPlatform/board/releases
Edit restyaboard/Dockerfile.
Available version is https://github.com/RestyaPlatform/board/releases
```yaml
environment:
RESTYABOARD_VERSION: REPLACE_ME
```
ENV restyaboard_version=REPLACE_ME
```
* Notice
If you install a higher than source version, it may not work, perhaps.
If you install a higher version than Dockerfile version, it may not work, perhaps.
License
......
......@@ -27,8 +27,6 @@ restyaboard:
- postgres:postgres
ports:
- 1234:80
environment:
RESTYABOARD_VERSION: v0.1.2
volumes_from:
- data
restart: always
FROM centos:7
# restyaboard version
ENV restyaboard_version=v0.1.2
# add repository
RUN \
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7; \
rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/packages/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm; \
sed -i 's/^enabled=1$/enabled=0/g' /etc/yum.repos.d/epel.repo; \
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi; \
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 &&\
rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/packages/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm &&\
sed -i 's/^enabled=1$/enabled=0/g' /etc/yum.repos.d/epel.repo &&\
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi &&\
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
COPY etc/yum.repos.d/nginx.repo /etc/yum.repos.d/
# update & install package
RUN \
yum update -y; \
yum install -y bzip2 cronie postfix postgresql; \
yum install -y --enablerepo=nginx nginx; \
yum install -y --enablerepo=remi-php56\
php php-fpm php-pgsql php-mbstring php-pecl-imagick; \
yum install -y --enablerepo=epel nodejs npm
yum update -y &&\
yum install -y bzip2 cronie postfix postgresql &&\
yum install -y --enablerepo=nginx nginx &&\
yum install -y --enablerepo=remi-php56\
php php-fpm php-pgsql php-mbstring php-pecl-imagick &&\
yum install -y --enablerepo=epel nodejs npm
RUN npm install -g grunt-cli
# setting php-fpm
RUN \
sed -i 's/^user = apache$/user = nginx/g' /etc/php-fpm.d/www.conf; \
sed -i 's/^group = apache$/group = nginx/g' /etc/php-fpm.d/www.conf
sed -i 's/^user = apache$/user = nginx/g' /etc/php-fpm.d/www.conf &&\
sed -i 's/^group = apache$/group = nginx/g' /etc/php-fpm.d/www.conf
# initial document root
RUN rm -rf /usr/share/nginx/html && mkdir /usr/share/nginx/html
# remove document root
RUN rm -rf /usr/share/nginx/html
# deploy app
WORKDIR /usr/share/nginx/html
RUN \
curl -L -o /tmp/restyaboard.tar.gz https://github.com/RestyaPlatform/board/archive/${restyaboard_version}.tar.gz &&\
tar xzvf /tmp/restyaboard.tar.gz --strip-components 1 &&\
rm /tmp/restyaboard.tar.gz &&\
cp -R media /tmp/ &&\
cp restyaboard.conf /etc/nginx/conf.d &&\
npm install &&\
grunt build:live
# volume
VOLUME /usr/share/nginx/html/media
......
......@@ -3,18 +3,6 @@
set -e
if [ "$1" = 'start' ]; then
# deploy
if [ ! -e /usr/share/nginx/html/restyaboard.conf ]; then
cd /tmp
curl -L -o restyaboard.tar.gz https://github.com/RestyaPlatform/board/archive/${RESTYABOARD_VERSION}.tar.gz
mkdir html && tar xzvf restyaboard.tar.gz -C html --strip-components 1
cp -rf html /usr/share/nginx/
cd /usr/share/nginx/html
cp restyaboard.conf /etc/nginx/conf.d
npm install
grunt build:live
fi
# config
sed -i "s/^.*'R_DB_NAME'.*$/define('R_DB_NAME', 'restyaboard');/g" \
/usr/share/nginx/html/server/php/R/config.inc.php
......@@ -29,6 +17,7 @@ if [ "$1" = 'start' ]; then
echo '*/5 * * * * php /usr/share/nginx/htmlserver/php/R/shell/cron.php' > /var/spool/cron/root
# media
cp -R /tmp/media /usr/share/nginx/html/
chmod -R go+w /usr/share/nginx/html/media
chmod -R go+w /usr/share/nginx/html/client/img
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment