mirror of
https://github.com/immich-app/immich.git
synced 2025-01-21 00:52:43 -05:00
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.
This commit is contained in:
parent
0b02fda4e0
commit
2d6d043336
3 changed files with 6 additions and 3 deletions
|
@ -55,6 +55,7 @@ services:
|
||||||
image: immich-web-dev:latest
|
image: immich-web-dev:latest
|
||||||
build:
|
build:
|
||||||
context: ../web
|
context: ../web
|
||||||
|
target: dev
|
||||||
command: ['/usr/src/app/bin/immich-web']
|
command: ['/usr/src/app/bin/immich-web']
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
|
|
@ -9,7 +9,6 @@ RUN npm ci && \
|
||||||
# they're marked as optional dependencies, so we need to copy them manually after pruning
|
# 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-libvips* && \
|
||||||
rm -rf node_modules/@img/sharp-linuxmusl-x64
|
rm -rf node_modules/@img/sharp-linuxmusl-x64
|
||||||
COPY server .
|
|
||||||
ENV PATH="${PATH}:/usr/src/app/bin" \
|
ENV PATH="${PATH}:/usr/src/app/bin" \
|
||||||
IMMICH_ENV=development \
|
IMMICH_ENV=development \
|
||||||
NVIDIA_DRIVER_CAPABILITIES=all \
|
NVIDIA_DRIVER_CAPABILITIES=all \
|
||||||
|
@ -19,6 +18,7 @@ ENTRYPOINT ["tini", "--", "/bin/sh"]
|
||||||
|
|
||||||
FROM dev AS prod
|
FROM dev AS prod
|
||||||
|
|
||||||
|
COPY server .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
RUN npm prune --omit=dev --omit=optional
|
RUN npm prune --omit=dev --omit=optional
|
||||||
COPY --from=dev /usr/src/app/node_modules/@img ./node_modules/@img
|
COPY --from=dev /usr/src/app/node_modules/@img ./node_modules/@img
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
FROM node:20.17.0-alpine3.20@sha256:2d07db07a2df6830718ae2a47db6fedce6745f5bcd174c398f2acdda90a11c03
|
FROM node:20.17.0-alpine3.20@sha256:2d07db07a2df6830718ae2a47db6fedce6745f5bcd174c398f2acdda90a11c03 AS dev
|
||||||
|
|
||||||
RUN apk add --no-cache tini
|
RUN apk add --no-cache tini
|
||||||
USER node
|
USER node
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY --chown=node:node package*.json ./
|
COPY --chown=node:node package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY --chown=node:node . .
|
|
||||||
ENV CHOKIDAR_USEPOLLING=true
|
ENV CHOKIDAR_USEPOLLING=true
|
||||||
EXPOSE 24678
|
EXPOSE 24678
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh"]
|
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh"]
|
||||||
|
|
||||||
|
FROM dev
|
||||||
|
COPY --chown=node:node . .
|
Loading…
Add table
Reference in a new issue