diff --git a/radicale/README.rst b/radicale/README.rst new file mode 100644 index 0000000..e69de29 diff --git a/radicale/build/Dockerfile b/radicale/build/Dockerfile new file mode 100644 index 0000000..4ebd74c --- /dev/null +++ b/radicale/build/Dockerfile @@ -0,0 +1,21 @@ +FROM debian:jessie + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip --no-install-recommends && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN pip3 install --upgrade radicale + +## XXXvlab: TO REMOVE, Ugh, git is needed only to install radicale_auth_ldap +## XXXvlab: This should be installed only if we link to ldap +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y git --no-install-recommends && \ + cd /tmp && git clone https://github.com/marcoh00/radicale-auth-ldap && \ + cd radicale-auth-ldap && python3 setup.py install && \ + cd .. && rm -rf radicale-auth-ldap && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + + +ENTRYPOINT [ "radicale" ] diff --git a/radicale/build/README b/radicale/build/README new file mode 100644 index 0000000..c687132 --- /dev/null +++ b/radicale/build/README @@ -0,0 +1,7 @@ +To use nix for building this image: + +nix-build . + +it'll give a file "result" that you can load in docker: + +docker load < result \ No newline at end of file diff --git a/radicale/build/default.nix b/radicale/build/default.nix new file mode 100644 index 0000000..320f219 --- /dev/null +++ b/radicale/build/default.nix @@ -0,0 +1,28 @@ +{ pkgs ? import {} }: + +with pkgs; +let + # entrypoint = writeScript "entrypoint.sh" '' + # #!${stdenv.shell} + # set -e + # exec "$@" + # ''; +in +dockerTools.buildImage { + name = "radicale"; + runAsRoot = '' + #!${stdenv.shell} + ${dockerTools.shadowSetup} + ''; + + contents = [ radicale ]; + + config = { + # Cmd = [ "radicale" ]; + Entrypoint = [ "radicale" ]; + ExposedPorts = { + "6379/tcp" = {}; + }; + WorkingDir = "/data"; + }; +} \ No newline at end of file diff --git a/radicale/hooks/init b/radicale/hooks/init new file mode 100755 index 0000000..d024dee --- /dev/null +++ b/radicale/hooks/init @@ -0,0 +1,38 @@ +#!/bin/bash + +## Init is run on host +## For now it is run every time the script is launched, but +## it should be launched only once after build. + +## Accessible variables are: +## - SERVICE_NAME Name of current service +## - DOCKER_BASE_IMAGE Base image from which this service might be built if any +## - SERVICE_DATASTORE Location on host of the DATASTORE of this service +## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service + + +set -u + +service_def=$(get_compose_service_def "$SERVICE_NAME") + +CONF="$SERVICE_CONFIGSTORE/etc/radicale/config" + +config=$(echo "$service_def" | shyaml get-value options.config 2>/dev/null) || { + die "Missing ${WHITE}config${NORMAL} option." +} + +file_put "$CONF" <" +## XXXvlab: currently only used when building LXC along with hooks/install +## XXXvlab: docker uses the 'build' directory or the 'image:' option here. +inherit: base-0k +compatiblity: ## 'hooks/install' script was run on a these images without issues + # - ubuntu/15.10 +docker-compose: + ## Note: we want apache to make the SSL part and authentication + ## XXXvlab: should move to global lxc/docker compatible option + # ports: + # - "5232:5232" +data-resources: + - /var/lib/radicale +config-resources: + ## Actually, we should/could probably have the config in YAML + - /etc/radicale