diff --git a/Dockerfile b/Dockerfile index 57b769a..51005f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM tomsquest/docker-radicale RUN apk add make jq +RUN apk add util-linux WORKDIR / +COPY production.mk $WORKDIR COPY Makefile $WORKDIR COPY .Radicale.props.jq $WORKDIR -RUN make -e APPLICATION=radicale -e DOMAIN=ocw.mit.edu - -CMD radicale --server-hosts 0.0.0.0:$PORT --config /config/config +# CMD radicale --server-hosts 0.0.0.0:$PORT --config /config/config diff --git a/Makefile b/Makefile index ae4c731..39ca7a0 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,31 @@ JQ = $(shell which jq) -COLLECTION_ROOT = $(APPLICATION)/data/collections/collection-root +USER = admin +COLLECTION_ROOT = data/collections/collection-root +STAGE = development -default: extract +include $(STAGE).mk +default: extract data/collections/.Radicale.lock -extract: $(COLLECTION_ROOT)/user/$(DOMAIN)/.Radicale.props +data/collections/.Radicale.lock: + touch $@ -$(COLLECTION_ROOT): - mkdir -p $@ - +extract: $(COLLECTION_ROOT)/$(USER)/$(DOMAIN)/.Radicale.props -$(COLLECTION_ROOT)/user/%/.Radicale.props: $(COLLECTION_ROOT) - rm -f $@ - mkdir -p `dirname $@` - $(JQ) -nc --arg name $(DOMAIN) --arg desc $(DOMAIN) --arg color '#000000' -f `basename $@`.jq > $@ - +$(COLLECTION_ROOT): + mkdir -p $@ -build: - docker build -t radicale:latest . +$(COLLECTION_ROOT)/$(USER)/%/.Radicale.props: $(COLLECTION_ROOT) + @rm -f $@ + @mkdir -p `dirname $@` + @$(JQ) -nc --arg name $(DOMAIN) --arg desc $(DOMAIN) --arg color '#000000' -f `basename $@`.jq > $@ + $(JQ) < $@ diff --git a/data/collections/.Radicale.lock b/data/collections/.Radicale.lock new file mode 100644 index 0000000..e69de29 diff --git a/data/collections/collection-root/admin/foobar/.Radicale.props b/data/collections/collection-root/admin/foobar/.Radicale.props new file mode 100644 index 0000000..6d6ecff --- /dev/null +++ b/data/collections/collection-root/admin/foobar/.Radicale.props @@ -0,0 +1 @@ +{"C:calendar-description":"test","C:supported-calendar-component-set":"VEVENT,VJOURNAL,VTODO","D:displayname":"test","ICAL:calendar-color":"#000000","tag":"VCALENDAR"} diff --git a/data/collections/collection-root/admin/test2/.Radicale.props b/data/collections/collection-root/admin/test2/.Radicale.props new file mode 100644 index 0000000..5367bb2 --- /dev/null +++ b/data/collections/collection-root/admin/test2/.Radicale.props @@ -0,0 +1 @@ +{"C:calendar-description":"test2","C:supported-calendar-component-set":"VEVENT,VJOURNAL,VTODO","D:displayname":"test2","ICAL:calendar-color":"#000000","tag":"VCALENDAR"} diff --git a/development.mk b/development.mk new file mode 100644 index 0000000..682af0a --- /dev/null +++ b/development.mk @@ -0,0 +1,30 @@ + +build: + PORT=$(PORT) docker build -t radicale:latest . + +run: build + docker run -d --name radical_test \ + -p 127.0.0.1:5232:5232 \ + --init \ + --read-only \ + --security-opt="no-new-privileges:true" \ + --cap-drop ALL \ + --cap-add CHOWN \ + --cap-add SETUID \ + --cap-add SETGID \ + --cap-add KILL \ + --pids-limit 50 \ + --memory 256M \ + --health-cmd="curl --fail http://localhost:5232 || exit 1" \ + --health-interval=30s \ + --health-retries=3 \ + -v $(shell pwd)/data:/data \ + radicale:latest + # -v ~/radicale/config:/config:ro \ + +test: + docker exec -it radical_test make -e DOMAIN=test -e STAGE=production + +clean: + docker stop radical_test + docker rm radical_test diff --git a/production.mk b/production.mk new file mode 100644 index 0000000..094c360 --- /dev/null +++ b/production.mk @@ -0,0 +1,26 @@ +STAGE = production + +run: + docker run -d --name radical_test \ + -p 127.0.0.1:5232:5232 \ + --init \ + --read-only \ + --security-opt="no-new-privileges:true" \ + --cap-drop ALL \ + --cap-add CHOWN \ + --cap-add SETUID \ + --cap-add SETGID \ + --cap-add KILL \ + --pids-limit 50 \ + --memory 256M \ + --health-cmd="curl --fail http://localhost:5232 || exit 1" \ + --health-interval=30s \ + --health-retries=3 \ + -v $(shell pwd)/data:/data \ + radicale:latest + # -v ~/radicale/config:/config:ro \ + # + + +calendar: default +