From 53855e45be24b23fc8565362473c70acb61ccf0c Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Wed, 17 Mar 2021 00:13:50 +0100 Subject: [PATCH] init --- .gitignore | 1 + Dockerfile | 17 +++++++++++++++++ config | 11 +++++++++++ docker-compose.yml | 8 ++++++++ entrypoint.sh | 12 ++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 config create mode 100644 docker-compose.yml create mode 100755 entrypoint.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8ad1b58 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.9 + +RUN apt update +RUN apt install -y apache2-utils + +RUN python3 -m pip install --upgrade radicale[bcrypt] + +WORKDIR /app + +COPY ./config /etc/radicale/config +COPY ./entrypoint.sh . + +ENV USER_FILE=/data/users + +VOLUME [ "/data" ] + +CMD [ "/app/entrypoint.sh" ] \ No newline at end of file diff --git a/config b/config new file mode 100644 index 0000000..d4be520 --- /dev/null +++ b/config @@ -0,0 +1,11 @@ +[server] +hosts = 0.0.0.0:5232 +ssl = False + +[auth] +type = htpasswd +htpasswd_filename = /data/users +htpasswd_encryption = bcrypt + +[storage] +filesystem_folder = /data/data \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1fb1a77 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.7' + +services: + app: + build: . + env_file: .env + ports: + - 80:5232 \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..06f5a59 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ! -f "$USER_FILE" ]; then + echo "No auth file found. Generating"; + DIR=$(dirname $USER_FILE) + mkdir -p $DIR + htpasswd -bB -c $USER_FILE $USER $PASSWORD; + echo "Done"; +fi + +echo "Starting Server"; +python -u -m radicale; \ No newline at end of file