2023-11-17 23:13:36 -05:00
|
|
|
# dev build
|
2023-12-14 22:22:06 -05:00
|
|
|
FROM ghcr.io/immich-app/base-server-dev:20231214@sha256:cd5be516b27c0c402bee3a6a93d8c83dfd5a827c18a2343cb97b55f3be98151b as dev
|
2022-11-09 20:53:21 -05:00
|
|
|
|
2023-12-08 21:58:07 -05:00
|
|
|
RUN apt-get install --no-install-recommends -yqq tini
|
2023-11-17 23:13:36 -05:00
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY server/package.json server/package-lock.json ./
|
2023-12-08 11:52:43 -05:00
|
|
|
RUN npm ci && \
|
|
|
|
# sharp-linux-x64 and sharp-linux-arm64 are the only ones we need
|
|
|
|
# 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
|
2023-11-17 23:13:36 -05:00
|
|
|
COPY server .
|
2023-12-13 12:10:00 -05:00
|
|
|
ENV PATH="${PATH}:/usr/src/app/bin"
|
2023-12-08 21:58:07 -05:00
|
|
|
ENTRYPOINT ["tini", "--", "/bin/sh"]
|
2022-02-03 15:42:27 -05:00
|
|
|
|
2023-11-09 08:12:05 -05:00
|
|
|
|
2023-11-17 23:13:36 -05:00
|
|
|
FROM dev AS prod
|
2022-11-10 23:22:17 -05:00
|
|
|
|
2022-06-07 08:08:22 -05:00
|
|
|
RUN npm run build
|
2023-02-02 22:28:34 -05:00
|
|
|
RUN npm prune --omit=dev --omit=optional
|
2023-12-08 11:52:43 -05:00
|
|
|
COPY --from=dev /usr/src/app/node_modules/@img ./node_modules/@img
|
2022-11-10 23:22:17 -05:00
|
|
|
|
2023-11-17 23:13:36 -05:00
|
|
|
# web build
|
2023-11-28 15:50:48 -05:00
|
|
|
FROM node:iron-alpine3.18 as web
|
2022-08-20 23:19:02 -05:00
|
|
|
|
2023-11-17 23:13:36 -05:00
|
|
|
WORKDIR /usr/src/app
|
2023-12-13 12:02:26 -05:00
|
|
|
COPY web/package*.json web/svelte.config.js .
|
2023-11-17 23:13:36 -05:00
|
|
|
RUN npm ci
|
|
|
|
COPY web .
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
|
|
# prod build
|
2023-12-14 22:22:06 -05:00
|
|
|
FROM ghcr.io/immich-app/base-server-prod:20231214@sha256:b214f86683fde081b09beed2d7bfc28bec55c829751ccf2e02ad7dd18293f5e0
|
2022-08-20 23:19:02 -05:00
|
|
|
|
2023-11-17 23:13:36 -05:00
|
|
|
WORKDIR /usr/src/app
|
2023-11-09 08:12:05 -05:00
|
|
|
ENV NODE_ENV=production
|
2022-11-10 23:22:17 -05:00
|
|
|
COPY --from=prod /usr/src/app/node_modules ./node_modules
|
|
|
|
COPY --from=prod /usr/src/app/dist ./dist
|
|
|
|
COPY --from=prod /usr/src/app/bin ./bin
|
2023-11-17 23:13:36 -05:00
|
|
|
COPY --from=web /usr/src/app/build ./www
|
2023-11-25 13:53:30 -05:00
|
|
|
COPY server/resources resources
|
2023-11-17 23:13:36 -05:00
|
|
|
COPY server/package.json server/package-lock.json ./
|
|
|
|
COPY server/start*.sh ./
|
|
|
|
RUN npm link && npm cache clean --force
|
2022-11-09 20:53:21 -05:00
|
|
|
COPY LICENSE /licenses/LICENSE.txt
|
|
|
|
COPY LICENSE /LICENSE
|
2023-11-30 15:59:47 -05:00
|
|
|
ENV PATH="${PATH}:/usr/src/app/bin"
|
2022-10-01 16:01:27 -05:00
|
|
|
VOLUME /usr/src/app/upload
|
2022-11-05 11:28:40 -05:00
|
|
|
EXPOSE 3001
|
2023-07-21 09:20:04 -05:00
|
|
|
ENTRYPOINT ["tini", "--", "/bin/sh"]
|