Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Some cleanup of the demo Dockerfile

Roland Geider9e878dcd02cd
diff --git a/extras/docker/demo/Dockerfile b/extras/docker/demo/Dockerfile
index 6d1ef8d42..a88164641 100644
--- a/extras/docker/demo/Dockerfile
+++ b/extras/docker/demo/Dockerfile
@@ -32,24 +32,31 @@ RUN apt update \
libpq-dev \
rustc \
cargo \
- yarnpkg \
sassc \
- && ln -s /usr/bin/yarnpkg /usr/bin/yarn \
&& ln -s /usr/bin/sassc /usr/bin/sass
+# Need a newer node than what's in ubuntu
+RUN wget -O- https://deb.nodesource.com/setup_22.x | bash - \
+ && apt-get update \
+ && apt-get install -y nodejs \
+ && rm -rf /var/lib/apt/lists/* \
+ && corepack enable
+
# Build the necessary python wheels
# Note that the --mount is a workaround for https://github.com/rust-lang/cargo/issues/8719
-COPY pyproject.toml .
-COPY wger/version.py ./wger/version.py
-COPY wger/__init__.py ./wger/__init__.py
-COPY README.md ./README.md
-RUN --mount=type=tmpfs,target=/root/.cargo pip3 wheel --no-cache-dir --wheel-dir /wheels --group docker . \
- && pip3 install --break-system-packages --user --no-cache-dir /wheels/*
-
-COPY . /home/wger/src
+#COPY . /home/wger/src
WORKDIR /home/wger/src
-RUN yarn install \
- && yarn build:css:sass
+
+COPY pyproject.toml /home/wger/src
+COPY wger/version.py /home/wger/src/wger/
+COPY wger/__init__.py /home/wger/src/wger/
+COPY README.md /home/wger/src
+COPY package.json /home/wger/src
+COPY yarn.lock /home/wger/src
+COPY wger/core/static /home/wger/src/wger/core/static
+RUN --mount=type=tmpfs,target=/root/.cargo pip3 wheel --no-cache-dir --wheel-dir /wheels --group docker . \
+ && yarn install \
+ && yarn build:css:sass
########
@@ -90,7 +97,6 @@ RUN chmod 0644 /etc/cron.d/wger \
&& chmod +x /home/wger/venvwrapper \
&& touch /var/log/cron.log
-COPY --from=builder /wheels /wheels
COPY --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
@@ -107,7 +113,7 @@ 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 \
+RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels . /home/wger/venv/bin/activate \
&& pip install --upgrade pip \
&& pip install --no-cache /wheels/* \
&& pip install -e . \
diff --git a/extras/docker/production/Dockerfile b/extras/docker/production/Dockerfile
index 3bc01a082..7a418ac42 100644
--- a/extras/docker/production/Dockerfile
+++ b/extras/docker/production/Dockerfile
@@ -35,7 +35,6 @@ RUN wget -O- https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get update \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* \
- && mkdir -p /etc/apt/keyrings \
&& corepack enable \
&& mkdir -p /root/src/wger/core/static