Self hosted FLOSS fitness/workout, nutrition and weight tracker
Refactor demo Dockerfile
Roland Geider1e8d62f21cbf
diff --git a/extras/docker/demo/Dockerfile b/extras/docker/demo/Dockerfileindex 3e00664fa..60d5af0be 100644--- a/extras/docker/demo/Dockerfile+++ b/extras/docker/demo/Dockerfile@@ -31,12 +31,22 @@ RUN apt update \libwebp-dev \libpq-dev \rustc \- cargo+ cargo \+ yarnpkg \+ sassc# Build the necessary python wheels# Note that the --mount is a workaround for https://github.com/rust-lang/cargo/issues/8719COPY requirements* ./-RUN --mount=type=tmpfs,target=/root/.cargo pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_docker.txt+RUN --mount=type=tmpfs,target=/root/.cargo pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_docker.txt \+ && pip3 install --break-system-packages --user --no-cache-dir /wheels/*++COPY . /home/wger/src+WORKDIR /home/wger/src+RUN ln -s /usr/bin/yarnpkg /usr/bin/yarn \+ && ln -s /usr/bin/sassc /usr/bin/sass \+ && yarn install \+ && yarn build:css:sass########@@ -69,14 +79,14 @@ RUN a2dissite 000-default.conf \# Configure cronCOPY ${DOCKER_DIR}/crontab /etc/cron.d/wgerCOPY ${DOCKER_DIR}/venvwrapper /home/wger/venvwrapper-COPY ${DOCKER_DIR}/entrypoint.sh /home/wger/entrypoint.shRUN chmod 0644 /etc/cron.d/wger \- && chmod +x /home/wger/venvwrapper /home/wger/entrypoint.sh \+ && chmod +x /home/wger/venvwrapper \&& touch /var/log/cron.logCOPY --from=builder /wheels /wheelsCOPY --chown=wger:www-data . /home/wger/src+COPY --from=builder --chown=wger:wger /home/wger/src/wger/core/static/yarn /home/wger/src/wger/core/static/yarn# Set up the applicationRUN ln -s /home/wger/static/CACHE /var/www@@ -84,29 +94,31 @@ USER wgerWORKDIR /home/wger/srcRUN python3 -m venv /home/wger/venv++# Change permissions of some files and folders so the apache process+# can access them.+RUN mkdir -p ~/static/CACHE ~/media \+ && ln -s /home/wger/static/CACHE /home/wger/src/CACHE \+ && chmod g+w /home/wger/static/CACHE+RUN . /home/wger/venv/bin/activate \&& pip install --upgrade pip \&& pip install --no-cache /wheels/* \&& pip install -e . \&& wger create-settings --database-path /home/wger/db/database.sqlite \- && wger bootstrap \- && wger load-online-fixtures \+ && sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \+ && echo STATIC_ROOT=\'/home/wger/static\' >> settings.py \+ && wger bootstrap --no-process-static \&& python3 manage.py sync-exercises \- && python3 manage.py download-exercise-images+ && wger load-online-fixtures \+ && python3 manage.py download-exercise-images \+ && python3 manage.py collectstatic --no-input-# Change permissions of some files and folders so the apache process-# can access them.-RUN mkdir -p ~/static/CACHE ~/media \- && ln -s /home/wger/static/CACHE /home/wger/src/CACHE \- && chmod g+w /home/wger/static/CACHE \- && sed -i "/^MEDIA_ROOT/c\MEDIA_ROOT='\/home\/wger\/media'" settings.py \- && echo STATIC_ROOT=\'/home/wger/static\' >> settings.pyUSER root-RUN apt-get remove build-essential -y \- && apt autoremove -y \- && chown :www-data -R /home/wger/db \+RUN chown :www-data -R /home/wger/db \+ && chown www-data:www-data -R /home/wger/static \&& chmod g+w /home/wger/db /home/wger/db/database.sqlite-ENTRYPOINT ["/home/wger/entrypoint.sh"]+CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]diff --git a/extras/docker/demo/entrypoint.sh b/extras/docker/demo/entrypoint.shdeleted file mode 100644index df5ae7465..000000000--- a/extras/docker/demo/entrypoint.sh+++ /dev/null@@ -1,14 +0,0 @@-#!/bin/sh--/home/wger/venvwrapper migrate--if [ "${DOWNLOAD_IMGS}" = "TRUE" ]; then- /home/wger/venvwrapper download-exercise-images- chmod -R g+w ~wger/media-fi--/home/wger/venvwrapper collectstatic --no-input-/home/wger/venvwrapper compress --force-chown www-data:www-data -R /home/wger/static--/usr/sbin/apache2ctl -D FOREGROUNDdiff --git a/extras/docker/production/Dockerfile b/extras/docker/production/Dockerfileindex bb151ab57..39b36ad9b 100644--- a/extras/docker/production/Dockerfile+++ b/extras/docker/production/Dockerfile@@ -37,7 +37,7 @@ RUN --mount=type=tmpfs,target=/root/.cargo \&& pip3 install --break-system-packages --user --no-cache-dir /wheels/*# Download and copy js and css files-COPY --chown=wger:wger . /home/wger/src+COPY . /home/wger/srcWORKDIR /home/wger/srcRUN ln -s /usr/bin/yarnpkg /usr/bin/yarn \&& ln -s /usr/bin/sassc /usr/bin/sass \