diff --git a/.dockerignore b/.dockerignore index fa0bb8a..16a0945 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ * !maloja +!container !Containerfile !requirements.txt !pyproject.toml diff --git a/Containerfile b/Containerfile index ed8a983..89f9678 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,4 @@ -FROM alpine:3.15 +FROM lsiobase/alpine:3.17 as base # Python image includes two Python versions, so use base Alpine # Based on the work of Jonathan Boeckel @@ -23,10 +23,12 @@ RUN \ pip install --no-cache-dir -r requirements.txt && \ apk del .build-deps +COPY container/root/ / + # no chance for caching below here -COPY . . +COPY --chown=abc:abc . . RUN pip install /usr/src/app @@ -36,5 +38,3 @@ ENV MALOJA_SKIP_SETUP=yes ENV PYTHONUNBUFFERED=1 EXPOSE 42010 -# use exec form for better signal handling https://docs.docker.com/engine/reference/builder/#entrypoint -ENTRYPOINT ["maloja", "run"] diff --git a/container/root/etc/s6-overlay/s6-rc.d/svc-python/dependencies.d/init-services b/container/root/etc/s6-overlay/s6-rc.d/svc-python/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/container/root/etc/s6-overlay/s6-rc.d/svc-python/run b/container/root/etc/s6-overlay/s6-rc.d/svc-python/run new file mode 100755 index 0000000..276e6be --- /dev/null +++ b/container/root/etc/s6-overlay/s6-rc.d/svc-python/run @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +# used https://github.com/linuxserver/docker-wikijs/blob/master/root/etc/s6-overlay/s6-rc.d/svc-wikijs/run as a template + +echo -e "\nMaloja is starting!" +exec \ + s6-setuidgid abc python -m maloja run \ No newline at end of file diff --git a/container/root/etc/s6-overlay/s6-rc.d/svc-python/type b/container/root/etc/s6-overlay/s6-rc.d/svc-python/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/container/root/etc/s6-overlay/s6-rc.d/svc-python/type @@ -0,0 +1 @@ +longrun diff --git a/container/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-python b/container/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-python new file mode 100644 index 0000000..e69de29