mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: reduce docker image size again and speed up build
it really was just order of operations... resolves #12582
This commit is contained in:
11
Dockerfile
11
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user