Commit a362e321 authored by Michiel de Jong's avatar Michiel de Jong

owncloud -> owncloud-git

parent c06b7a57
......@@ -7,7 +7,7 @@ RUN apt-get update \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN curl -L http://assets.withknown.com/releases/known-0.6.5.tgz
RUN cd /init && curl -L http://assets.withknown.com/releases/known-0.6.5.tgz
COPY init/known.sh /init/known.sh
COPY init/config.ini /init/config.ini
#!/bin/bash
$VERSION = 0.6.5
VERSION="0.6.5"
echo "Extracting Known {$VERSION}..."
echo "Extracting Known $(VERSION}..."
cd /data/www-content
tar xzf /known-$VERSION.tgz
tar xzf /init/known-$VERSION.tgz
echo "Setting default config..."
cp /init/config.ini .
......
FROM indiehosters/lamp-git
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -yq install \
bzip2 \
pwgen \
&& rm -rf /var/lib/apt/lists/*
RUN cd /init && curl -O https://download.owncloud.org/community/owncloud-7.0.2.tar.bz2
COPY init/owncloud.sh /init/owncloud.sh
COPY init/config.php /init/config.php
# owncloud-git
This image adds ownCloud to the lamp-git image:
````
sudo docker build -t indiehosters/owncloud-git .
sudo docker run -it -v $(pwd)/data:/data -p 80:80 indiehosters/owncloud-git /bin/bash
````
And inside:
````
sh /run.sh &
sh /init/generic.sh
sh /init/owncloud.sh
exit
````
Now you don't need this specific image anymore, but can run your instance with the generic lamp-git image:
````
sudo docker build -t indiehosters/lamp-git .
sudo docker run -it -v $(pwd)/data:/data -p 80:80 indiehosters/lamp-git /bin/bash
````
#!/bin/bash
VERSION="7.0.2"
echo "Extracting ownCloud ${VERSION}..."
cd /data
tar xjf /init/owncloud-$VERSION.tar.bz2
rm -rf www-content
mv owncloud www-content
echo "Setting default config..."
cp /init/config.php ./www-content
chown -R root:www-data /data/www-content
chmod -R g+w /data/www-content
echo "Creating empty database..."
echo "CREATE DATABASE IF NOT EXISTS owncloud" | mysql
PWD=`pwgen 40 1`
echo "user: " > /data/login.txt
echo "pass: $PWD" >> /data/login.txt
echo "Please use your browser to set up a user, and edit /data/login.txt manually:"
cat /data/login.txt
FROM indiehosters/lamp
# Download latest version of ownCloud into /app
RUN apt-get update && \
apt-get -yq install \
bzip2 && \
curl -L https://download.owncloud.org/community/owncloud-7.0.2.tar.bz2 \
| tar xj && \
mv owncloud/* app && \
apt-get -yq remove bzip2 && \
apt-get -yq autoclean && \
rm -rf /var/lib/apt/lists/*
ADD oc-config.php /app/oc-config.php
# Add script to create 'owncloud' DB
ADD run-owncloud.sh /run-owncloud.sh
RUN chmod 755 /run-owncloud.sh
RUN chmod -R 775 /app/config
# Expose environment variables
ENV DB_HOST **LinkMe**
ENV DB_PORT **LinkMe**
ENV DB_NAME owncloud
ENV DB_USER admin
ENV DB_PASS **ChangeMe**
EXPOSE 80
VOLUME ["/app"]
CMD ["/run-owncloud.sh"]
# Work in progress
This image doesn't work yet, still needs some permissions tweaking and such.
# Usage:
````
PASS=`pwgen 20 1`
sudo docker pull debian:jessie
sudo docker build -t indiehosters/lamp ../lamp
sudo docker build -t indiehosters/owncloud .
sudo docker run -d -e MYSQL_PASS=$PASS --name mysql indiehosters/mysql
sudo docker run -d -p 80:80 --link mysql:db -e DB_PASS=$PASS indiehosters/owncloud
echo Using $PASS as the database password. Waiting for everything to be up...
sleep 20
curl -I http://localhost/
````
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.owncloud.org/Editing_oc-config.php Editing
* oc-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the oc-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "oc-config.php" and fill in the values.
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', getenv('DB_NAME'));
/** MySQL database username */
define('DB_USER', getenv('DB_USER'));
/** MySQL database password */
define('DB_PASSWORD', getenv('DB_PASS'));
/** MySQL hostname */
define('DB_HOST', getenv('DB_HOST').":".getenv('DB_PORT'));
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.owncloud.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '--w,=nO-t>g:EOH>e-ZXs!7x(: W4:}1A2$E?Sn9P>TW-[=:u[nc-eQ<vIi<6|wh');
define('SECURE_AUTH_KEY', 'PlM~WQ/9-~V:-3&be`nxuaghz@JyN!]SzVr_]lAM2b?QH(d(|`.z_;1jIE4kY&f+');
define('LOGGED_IN_KEY', 'K]6*uCb-m~>zj5C1krtu:>2VT(WlI/Jl5T~Pov2-`r+Zb5s3i6&aIN$*/+k/~sLN');
define('NONCE_KEY', '~; xvP`h^{Pl9zaD#/!f@M21BAk0#sKg>*P+=1LV+FY+;HNE)%Y`4(Xq|&})fCj^');
define('AUTH_SALT', 'A2|G[jvSLB+z dy S/ S>(lLyzxDvJ8(ps1(F%~x]eRD`UHv(h*IDjye+SYV-a;O');
define('SECURE_AUTH_SALT', '9cv/Hy~a;qr]4)i*udy-/$non@_:CU0SIdm-L[WH^k_}s:Jq[)HV,Wu8na<_;ef3');
define('LOGGED_IN_SALT', '{d*4OCrk9x`|cb-4EBK7=ewJ3D]y%z,7mSEd:8?=eP![zD.O`<Uubt-u%@TA+x T');
define('NONCE_SALT', 'z6G5thFC]JIW]|ZQIBgZ?zBb^!N#3-Un=)`!Xb/,Yd8[2&}.W{ITu?=PE0oZ,<8^');
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'oc_';
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to oc-content/languages. For example, install
* de_DE.mo to oc-content/languages and set OCLANG to 'de_DE' to enable German
* language support.
*/
define('OCLANG', '');
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use OC_DEBUG
* in their development environments.
*/
define('OC_DEBUG', false);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'oc-settings.php');
/** change permisssions for plugin installation */
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
#!/bin/bash
chown -R root:www-data /app
chmod -R 650 /app
chmod -R 770 /app/oc-content/
chmod -R 660 /app/.htaccess
if [ -f /.mysql_db_created ]; then
exec /run.sh
exit 1
fi
DB_HOST=${DB_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_HOST=${DB_1_PORT_3306_TCP_ADDR:-${DB_HOST}}
DB_PORT=${DB_PORT_3306_TCP_PORT:-${DB_PORT}}
DB_PORT=${DB_1_PORT_3306_TCP_PORT:-${DB_PORT}}
if [ "$DB_PASS" = "**ChangeMe**" ] && [ -n "$DB_1_ENV_MYSQL_PASS" ]; then
DB_PASS="$DB_1_ENV_MYSQL_PASS"
fi
echo "=> Trying to connect to MySQL/MariaDB using:"
echo "========================================================================"
echo " Database Host Address: $DB_HOST"
echo " Database Port number: $DB_PORT"
echo " Database Name: $DB_NAME"
echo " Database Username: $DB_USER"
echo " Database Password: $DB_PASS"
echo "========================================================================"
for ((i=0;i<10;i++))
do
DB_CONNECTABLE=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
sleep 5
done
if [[ $DB_CONNECTABLE -eq 0 ]]; then
DB_EXISTS=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "SHOW DATABASES LIKE '"$DB_NAME"';" 2>&1 |grep "$DB_NAME" > /dev/null ; echo "$?")
if [[ DB_EXISTS -eq 1 ]]; then
echo "=> Creating database $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e "CREATE DATABASE $DB_NAME")
if [[ RET -ne 0 ]]; then
echo "Cannot create database for owncloud"
exit RET
fi
if [ -f /initial_db.sql ]; then
echo "=> Loading initial database data to $DB_NAME"
RET=$(mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME < /initial_db.sql)
if [[ RET -ne 0 ]]; then
echo "Cannot load initial database data for owncloud"
exit RET
fi
fi
echo "=> Done!"
else
echo "=> Skipped creation of database $DB_NAME – it already exists."
fi
else
echo "Cannot connect to Mysql"
exit $DB_CONNECTABLE
fi
touch /.mysql_db_created
exec /run.sh
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