Move some commands to first run script
This commit is contained in:
parent
0350f0d5b1
commit
7b7c0f445d
@ -9,12 +9,7 @@ RUN apt-get update && \
|
||||
apt-get clean
|
||||
|
||||
# Make required catalogs
|
||||
RUN mkdir -p /data/mysql \
|
||||
/data/owncloud \
|
||||
/data/owncloud/config \
|
||||
/data/owncloud/data \
|
||||
/data/nginx-log \
|
||||
/run/mysqld \
|
||||
RUN mkdir -p /run/mysqld \
|
||||
/run/php
|
||||
|
||||
# Setup php
|
||||
@ -28,8 +23,7 @@ RUN sed -i "s/\/var\/log\/nginx/\/data\/nginx-log/g" /etc/nginx/nginx.conf
|
||||
|
||||
# Setup MySQL
|
||||
RUN sed -i "s/\/var\/lib\/mysql/\/data\/mysql/g" /etc/mysql/mysql.conf.d/mysqld.cnf
|
||||
RUN mv /var/lib/mysql/* /data/mysql
|
||||
RUN chown mysql:mysql /data/mysql /var/run/mysqld
|
||||
RUN chown mysql:mysql /var/run/mysqld
|
||||
|
||||
# Setup owncloud
|
||||
RUN rm -rf /var/www/*
|
||||
@ -40,12 +34,6 @@ RUN rm /var/www/owncloud-${OWNCLOUD_VER}.tar.bz2 \
|
||||
/var/www/owncloud/.htaccess \
|
||||
/var/www/owncloud/.user.ini
|
||||
RUN rmdir /var/www/owncloud
|
||||
RUN mv /var/www/apps /data/owncloud && \
|
||||
mv /var/www/config /data/config
|
||||
RUN ln -s /data/owncloud/config /var/www && \
|
||||
ln -s /data/owncloud/apps /var/www && \
|
||||
ln -s /data/owncloud/data /var/www
|
||||
RUN chown -R www-data:www-data /data/owncloud /var/www
|
||||
|
||||
EXPOSE 80
|
||||
VOLUME ["/data"]
|
||||
|
@ -3,6 +3,23 @@
|
||||
function first_run() {
|
||||
echo FIRST RUN
|
||||
|
||||
mkdir -p /data/owncloud \
|
||||
/data/owncloud/config \
|
||||
/data/owncloud/data \
|
||||
/data/nginx-log
|
||||
|
||||
cp -r /var/www/apps /data/owncloud
|
||||
cp -r /var/www/config /data/owncloud
|
||||
cp -r /var/lib/mysql /data
|
||||
rm -rf /var/www/apps \
|
||||
/var/www/config
|
||||
ln -s /data/owncloud/config /var/www
|
||||
ln -s /data/owncloud/apps /var/www
|
||||
ln -s /data/owncloud/data /var/www
|
||||
|
||||
chown -R www-data:www-data /data/owncloud /var/www
|
||||
chown -R mysql:mysql /data/mysql
|
||||
|
||||
SQL_ROOT_PASSWORD="$(pwgen -s -1 16)"
|
||||
SQL_OWNCLOUD_PASSWORD="$(pwgen -s -1 16)"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user