1
0
mirror of https://github.com/immich-app/immich.git synced 2025-10-31 00:18:28 +02:00

feat: update server env vars for layout

This commit is contained in:
midzelis
2025-07-12 15:50:46 +00:00
parent 564c384e3d
commit 76bfd3f490
6 changed files with 41 additions and 25 deletions

View File

@@ -16,7 +16,7 @@ name: immich-dev
services:
immich-server:
container_name: immich_server
command: ['/usr/src/app/server/bin/immich-dev']
command: ['immich-dev']
image: immich-server-dev:latest
# extends:
# file: hwaccel.transcoding.yml
@@ -71,7 +71,7 @@ services:
build:
context: ../
dockerfile: web/Dockerfile
command: ['/usr/src/app/web/bin/immich-web']
command: ['immich-web']
env_file:
- .env
ports:

View File

@@ -3,7 +3,6 @@ name: immich-e2e
services:
immich-server:
container_name: immich-e2e-server
command: ['./start.sh']
image: immich-server:latest
build:
context: ../

View File

@@ -9,11 +9,11 @@ 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
ENV PATH="${PATH}:/usr/src/app/bin" \
ENV PATH="${PATH}:/usr/src/app/server/bin:/usr/src/app/server" \
IMMICH_ENV=development \
NVIDIA_DRIVER_CAPABILITIES=all \
NVIDIA_VISIBLE_DEVICES=all
ENTRYPOINT ["tini", "--", "/bin/sh"]
ENTRYPOINT ["tini", "--", "/bin/bash", "-c"]
FROM dev AS dev-container-server
@@ -98,22 +98,21 @@ RUN npm ci && npm run build
# prod build
FROM ghcr.io/immich-app/base-server-prod:202507091427@sha256:ad10451acd8eda05a006a2586b6b0425cdaaca97c413fb4c1a10896712528bdc
WORKDIR /usr/src/app/server
WORKDIR /usr/src/app
ENV NODE_ENV=production \
NVIDIA_DRIVER_CAPABILITIES=all \
NVIDIA_VISIBLE_DEVICES=all
COPY --from=prod /usr/src/app/server/node_modules ./node_modules
COPY --from=prod /usr/src/app/server/dist ./dist
COPY --from=prod /usr/src/app/server/bin ./bin
COPY --from=prod /usr/src/app/server/bin ./server/bin
COPY --from=prod /usr/src/app/server/dist ./server/dist
COPY --from=prod /usr/src/app/server/node_modules ./server/node_modules
COPY --from=prod /usr/src/app/server/resources ./server
COPY --from=prod /usr/src/app/server/start.sh /usr/src/app/server/package.json ./server/
COPY --from=web /usr/src/app/web/build /build/www
COPY ./server/resources resources
COPY ./server/package.json server/package-lock.json ./
COPY ./server/start*.sh ./
COPY "docker/scripts/get-cpus.sh" ./
COPY "docker/scripts/get-cpus.sh" ./server/
RUN npm install -g @immich/cli && npm cache clean --force
COPY LICENSE /licenses/LICENSE.txt
COPY LICENSE /LICENSE
ENV PATH="${PATH}:/usr/src/app/bin"
ENV PATH="${PATH}:/usr/src/app/server/bin:/usr/src/app/server"
ARG BUILD_ID
ARG BUILD_IMAGE
@@ -132,7 +131,7 @@ ENV IMMICH_SOURCE_URL=https://github.com/immich-app/immich/commit/${BUILD_SOURCE
VOLUME /usr/src/app/upload
EXPOSE 2283
ENTRYPOINT ["tini", "--", "/bin/bash"]
ENTRYPOINT ["tini", "--", "/bin/bash", "-c"]
CMD ["start.sh"]
HEALTHCHECK CMD immich-healthcheck

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env sh
/usr/src/app/start.sh immich-admin "$@"
start.sh immich-admin "$@"

View File

@@ -3,9 +3,13 @@
echo "Initializing Immich $IMMICH_SOURCE_REF"
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
export LD_PRELOAD="$lib_path"
if [ -f "$lib_path" ]; then
export LD_PRELOAD="$lib_path"
else
echo "skipping libmimalloc - path not found $lib_path"
fi
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/jellyfin-ffmpeg/lib"
export SERVER_HOME=/usr/src/app
export SERVER_HOME=/usr/src/app/server
export BASE_FOLDER=/usr/src/app
read_file_and_export() {
@@ -22,10 +26,23 @@ read_file_and_export "DB_USERNAME_FILE" "DB_USERNAME"
read_file_and_export "DB_PASSWORD_FILE" "DB_PASSWORD"
read_file_and_export "REDIS_PASSWORD_FILE" "REDIS_PASSWORD"
export CPU_CORES="${CPU_CORES:=$(./get-cpus.sh)}"
echo "Detected CPU Cores: $CPU_CORES"
if [ "$CPU_CORES" -gt 4 ]; then
export UV_THREADPOOL_SIZE=$CPU_CORES
if [ -f "$SERVER_HOME/get-cpus.sh" ]; then
export CPU_CORES="${CPU_CORES:=$("$SERVER_HOME/get-cpus.sh")}"
echo "Detected CPU Cores: $CPU_CORES"
if [ "$CPU_CORES" -gt 4 ]; then
export UV_THREADPOOL_SIZE=$CPU_CORES
fi
else
echo "skipping $SERVER_HOME/get-cpus.sh - path not found: using default CPU cores"
fi
if [ -f "${SERVER_HOME}/dist/main.js" ]; then
exec node "${SERVER_HOME}/dist/main.js" "$@"
else
echo "Error: ${SERVER_HOME}/dist/main.js not found"
if [ "$IMMICH_ENV" = "development" ]; then
echo "You may need to build the server first."
fi
exit 1
fi
exec node "${SERVER_HOME}/dist/main" "$@"

View File

@@ -7,7 +7,8 @@ WORKDIR /usr/src/app/web
COPY --chown=node:node ./web/package* ./
RUN npm ci
ENV CHOKIDAR_USEPOLLING=true
ENV CHOKIDAR_USEPOLLING=true \
PATH="${PATH}:/usr/src/app/web/bin"
EXPOSE 24678
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh"]
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh", "-c"]