From 56ef2bdd67c0e0f6015db804140c3ee3c58e5c32 Mon Sep 17 00:00:00 2001 From: Opliko Date: Thu, 23 May 2024 23:52:33 +0200 Subject: [PATCH] fix: reduce docker image size again and speed up build it really was just order of operations... resolves #12582 --- Dockerfile | 11 ++++++----- dev.Dockerfile | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9778513430..f3b76ab35b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,15 +46,16 @@ ENV NODE_ENV=production \ WORKDIR /usr/src/app/ -COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ -COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ - RUN corepack enable \ && groupadd --gid ${GID} ${USER} \ && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ && mkdir -p /usr/src/app/logs/ /opt/config/ \ - && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ \ - && chmod +x /usr/local/bin/entrypoint.sh \ + && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ + +COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ +COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ + +RUN chmod +x /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/tini # TODO: Have docker-compose use environment variables to create files like setup.json and config.json. diff --git a/dev.Dockerfile b/dev.Dockerfile index a2b3867ed5..bab7d800c5 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -51,17 +51,18 @@ ENV NODE_ENV=development \ WORKDIR /usr/src/app/ +RUN corepack enable \ + && groupadd --gid ${GID} ${USER} \ + && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ + && mkdir -p /usr/src/app/logs/ /opt/config/ \ + && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ + COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ COPY --from=node_modules_touch --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/ COPY --from=git --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/ -RUN corepack enable \ - && groupadd --gid ${GID} ${USER} \ - && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ - && mkdir -p /usr/src/app/logs/ /opt/config/ \ - && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ \ - && chmod +x /usr/local/bin/entrypoint.sh \ +RUN chmod +x /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/tini # TODO: Have docker-compose use environment variables to create files like setup.json and config.json.