From 34f853159e5964e16712232388cd4ae203fdf72b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 22 May 2023 18:44:21 +0200 Subject: [PATCH] build(docker): Fix production Dockerfile Make sure every data folder properly exists See https://forge.tedomum.net/tedomum/mobilizon/-/issues/14 Signed-off-by: Thomas Citharel --- docker/production/Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 9a84bd9fb..1b5370e5b 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -1,5 +1,5 @@ # First build the application assets -FROM node:16-alpine as assets +FROM node:18-alpine as assets RUN apk add --no-cache python3 build-base libwebp-tools bash imagemagick ncurses WORKDIR /build @@ -49,11 +49,17 @@ LABEL org.opencontainers.image.title="mobilizon" \ RUN apk add --no-cache curl openssl ca-certificates ncurses-libs file postgresql-client libgcc libstdc++ imagemagick python3 py3-pip py3-pillow py3-cffi py3-brotli gcc g++ musl-dev python3-dev pango libxslt-dev ttf-cantarell openssl1.1-compat RUN pip install weasyprint pyexcel-ods3 +# Create every data directory RUN mkdir -p /var/lib/mobilizon/uploads && chown nobody:nobody /var/lib/mobilizon/uploads +RUN mkdir -p /var/lib/mobilizon/timezones && chown nobody:nobody /var/lib/mobilizon/timezones +RUN mkdir -p /var/lib/mobilizon/tzdata && chown nobody:nobody /var/lib/mobilizon/tzdata RUN mkdir -p /var/lib/mobilizon/uploads/exports/{csv,pdf,ods} && chown -R nobody:nobody /var/lib/mobilizon/uploads/exports -RUN mkdir -p /var/lib/mobilizon/timezones + +# Get timezone geodata RUN curl -L 'https://packages.joinmobilizon.org/tz_world/timezones-geodata.dets' -o /var/lib/mobilizon/timezones/timezones-geodata.dets -RUN chown nobody:nobody /var/lib/mobilizon/timezones +RUN chown -R nobody:nobody /var/lib/mobilizon/timezones + +# Create configuration directory RUN mkdir -p /etc/mobilizon && chown nobody:nobody /etc/mobilizon USER nobody