From 4497dd174e9d9e193adecd40c91ca791dcf8eefc Mon Sep 17 00:00:00 2001 From: Yonathan Randolph Date: Mon, 13 Jan 2025 19:00:55 -0800 Subject: [PATCH] chore(server): avoid copying sources in dev (#12794) * chore(server): avoid copying sources in dev Add a dev target to the web and server Dockerfiles, and change docker-compose.dev.yml to use the dev target. The dev target avoids copying files so that the docker image is smaller. * chore: respond to PR: don't add dev target web/Dockerfile is only used by docker-compose.dev.yml so a dev target is redundant. Instead, just remove the copy --------- Co-authored-by: Jason Rasmussen --- server/Dockerfile | 2 +- web/Dockerfile | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index e4fb6d43521eb5..85c3ffae1f2422 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -9,7 +9,6 @@ RUN npm ci && \ # they're marked as optional dependencies, so we need to copy them manually after pruning rm -rf node_modules/@img/sharp-libvips* && \ rm -rf node_modules/@img/sharp-linuxmusl-x64 -COPY server . ENV PATH="${PATH}:/usr/src/app/bin" \ IMMICH_ENV=development \ NVIDIA_DRIVER_CAPABILITIES=all \ @@ -19,6 +18,7 @@ ENTRYPOINT ["tini", "--", "/bin/sh"] FROM dev AS prod +COPY server . RUN npm run build RUN npm prune --omit=dev --omit=optional COPY --from=dev /usr/src/app/node_modules/@img ./node_modules/@img diff --git a/web/Dockerfile b/web/Dockerfile index bf6aa5af5c2b7d..dfef1d83481d39 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -5,7 +5,6 @@ USER node WORKDIR /usr/src/app COPY --chown=node:node package*.json ./ RUN npm ci -COPY --chown=node:node . . ENV CHOKIDAR_USEPOLLING=true EXPOSE 24678 EXPOSE 3000