From a46c7b8f02f04e4a769a59441171207c0ea851ec Mon Sep 17 00:00:00 2001 From: meliurwen Date: Sat, 22 Aug 2020 00:56:52 +0200 Subject: [PATCH] Moved on git --- .env.example | 19 +++++++++++++++++++ .gitignore | 1 + Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ nc_db.env.example | 4 ++++ nextcloud.env.example | 11 +++++++++++ 6 files changed, 87 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nc_db.env.example create mode 100644 nextcloud.env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..32190f5 --- /dev/null +++ b/.env.example @@ -0,0 +1,19 @@ +# Global Settings +LOCAL_STACK_DIR=/srv/docker/volumes/nextcloud + +# Networks +NETWORK=webservices + +# nextcloud (optional) +NC_CONTAINER_NAME= +NC_RESTART= +MYSQL_HOST= + +# db +MYSQL_ROOT_PASSWORD= + +# db (optional) +DB_IMG= +DB_TAG= +DB_CONTAINER_NAME= +DB_RESTART= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03bd412 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9cc602b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM nextcloud:latest + +LABEL maintainer="Meliurwen " + +# The line with `sed` command simply inserts the command `service cron start` +# at the second line of the `entrypoint.sh` file +RUN apt-get -q update && \ + apt-get -qq install \ + cron \ + nano-tiny && \ + echo "*/15 * * * * su - www-data -s /bin/bash -c \"php -f /var/www/html/cron.php\"" | crontab - && \ + sed -i '2 i\service cron start' /entrypoint.sh && \ + apt-get purge -y nano-tiny && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get autoremove --purge && \ + apt-get clean diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2326bb9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +version: "3" + +services: + nextcloud: + ## Using Dockerfile because I want tu use 'cron' + ## and I need to add it first to the pure image + #image: nextcloud:latest + build: . + container_name: ${NC_CONTAINER_NAME:-nextcloud} + restart: ${NC_RESTART:-unless-stopped} + depends_on: + - cloud-db + volumes: + - ${LOCAL_STACK_DIR}/nextcloud/data:/var/www/html + - /etc/timezone:/etc/timezone:ro + env_file: + - nextcloud.env + - nc_db.env + environment: + MYSQL_HOST: ${MYSQL_HOST:-nextcloud-db} + + db: + image: ${DB_IMG:-mariadb}:${DB_TAG:-latest} + container_name: ${DB_CONTAINER_NAME:-nextcloud-db} + restart: ${DB_RESTART:-unless-stopped} + volumes: + - ${LOCAL_STACK_DIR}/db/data:/var/lib/mysql + env_file: + - nc_db.env + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + +networks: + default: + external: + name: ${NETWORK} diff --git a/nc_db.env.example b/nc_db.env.example new file mode 100644 index 0000000..b16256c --- /dev/null +++ b/nc_db.env.example @@ -0,0 +1,4 @@ +# nextcloud and db +MYSQL_DATABASE=nextcloud +MYSQL_USER=nextcloud +MYSQL_PASSWORD= diff --git a/nextcloud.env.example b/nextcloud.env.example new file mode 100644 index 0000000..31de005 --- /dev/null +++ b/nextcloud.env.example @@ -0,0 +1,11 @@ +# nextcloud +NEXTCLOUD_ADMIN_USER= +NEXTCLOUD_ADMIN_PASSWORD= +NEXTCLOUD_DATA_DIR=/var/www/html/data +NEXTCLOUD_TABLE_PREFIX= + +# Reverse-proxy and certbot +VIRTUAL_HOST=subdomain.domain.tld +VIRTUAL_PORT=80 +LETSENCRYPT_HOST=subdomain.domain.tld +LETSENCRYPT_EMAIL=username@domain.tld