update devcontainer for pnpm

This commit is contained in:
midzelis 2025-07-18 23:06:22 +00:00
parent c6708865f2
commit 8185d5ebea
6 changed files with 47 additions and 22 deletions

View File

@ -8,11 +8,16 @@ services:
- IMMICH_SERVER_URL=http://127.0.0.1:2283/ - IMMICH_SERVER_URL=http://127.0.0.1:2283/
volumes: !override volumes: !override
- ..:/workspaces/immich - ..:/workspaces/immich
- cli_node_modules:/workspaces/immich/cli/node_modules - pnpm-store:/workspaces/immich/.pnpm-store
- e2e_node_modules:/workspaces/immich/e2e/node_modules - /workspaces/immich/.github/node_modules
- open_api_node_modules:/workspaces/immich/open-api/typescript-sdk/node_modules - /workspaces/immich/cli/node_modules
- server_node_modules:/workspaces/immich/server/node_modules - /workspaces/immich/docs/node_modules
- web_node_modules:/workspaces/immich/web/node_modules - /workspaces/immich/e2e/node_modules
- /workspaces/immich/open-api/typescript-sdk/node_modules
- /workspaces/immich/web/.svelte-kit
- /workspaces/immich/web/coverage
- /workspaces/immich/web/node_modules
- /workspaces/immich/server/node_modules
- ${UPLOAD_LOCATION:-upload1-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/usr/src/app/upload - ${UPLOAD_LOCATION:-upload1-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/usr/src/app/upload
- ${UPLOAD_LOCATION:-upload2-devcontainer-volume}${UPLOAD_LOCATION:+/photos/upload}:/usr/src/app/upload/upload - ${UPLOAD_LOCATION:-upload2-devcontainer-volume}${UPLOAD_LOCATION:+/photos/upload}:/usr/src/app/upload/upload
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
@ -39,11 +44,7 @@ services:
volumes: volumes:
# Node modules for each service to avoid conflicts and ensure consistent dependencies # Node modules for each service to avoid conflicts and ensure consistent dependencies
cli_node_modules: pnpm-store:
e2e_node_modules:
open_api_node_modules:
server_node_modules:
web_node_modules:
upload1-devcontainer-volume: upload1-devcontainer-volume:
upload2-devcontainer-volume: upload2-devcontainer-volume:
postgres-devcontainer-volume: postgres-devcontainer-volume:

View File

@ -3,6 +3,11 @@
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source /immich-devcontainer/container-common.sh source /immich-devcontainer/container-common.sh
log "Preparing Immich Nest API Server"
log ""
export CI=1
run_cmd pnpm --filter immich install
log "Starting Nest API Server" log "Starting Nest API Server"
log "" log ""
cd "${IMMICH_WORKSPACE}/server" || ( cd "${IMMICH_WORKSPACE}/server" || (
@ -10,9 +15,8 @@ cd "${IMMICH_WORKSPACE}/server" || (
exit 1 exit 1
) )
CI=1 pnpm install
while true; do while true; do
run_cmd pnpm exec nest start --debug "0.0.0.0:9230" --watch run_cmd pnpm --filter immich exec nest start --debug "0.0.0.0:9230" --watch
log "Nest API Server crashed with exit code $?. Respawning in 3s ..." log "Nest API Server crashed with exit code $?. Respawning in 3s ..."
sleep 3 sleep 3
done done

View File

@ -3,6 +3,13 @@
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source /immich-devcontainer/container-common.sh source /immich-devcontainer/container-common.sh
export CI=1
log "Preparing Immich Web Frontend"
log ""
run_cmd pnpm --filter @immich/sdk install
run_cmd pnpm --filter @immich/sdk build
run_cmd pnpm --filter immich-web install
log "Starting Immich Web Frontend" log "Starting Immich Web Frontend"
log "" log ""
cd "${IMMICH_WORKSPACE}/web" || ( cd "${IMMICH_WORKSPACE}/web" || (
@ -16,7 +23,7 @@ until curl --output /dev/null --silent --head --fail "http://127.0.0.1:${IMMICH_
done done
while true; do while true; do
run_cmd pnpm exec vite dev --host 0.0.0.0 --port "${DEV_PORT}" run_cmd pnpm --filter immich-web exec vite dev --host 0.0.0.0 --port "${DEV_PORT}"
log "Web crashed with exit code $?. Respawning in 3s ..." log "Web crashed with exit code $?. Respawning in 3s ..."
sleep 3 sleep 3
done done

View File

@ -6,9 +6,6 @@ source /immich-devcontainer/container-common.sh
log "Setting up Immich dev container..." log "Setting up Immich dev container..."
fix_permissions fix_permissions
log "Installing npm dependencies (node_modules)..."
install_dependencies
log "Setup complete, please wait while backend and frontend services automatically start" log "Setup complete, please wait while backend and frontend services automatically start"
log log
log "If necessary, the services may be manually started using" log "If necessary, the services may be manually started using"

0
a Normal file
View File

View File

@ -12,7 +12,16 @@ RUN echo "umask 000" | tee /etc/profile /etc/bash.bashrc >/dev/null && \
mkdir -p /usr/src/app/upload && \ mkdir -p /usr/src/app/upload && \
corepack enable pnpm && \ corepack enable pnpm && \
pnpm config set store-dir /buildcache/pnpm-store && \ pnpm config set store-dir /buildcache/pnpm-store && \
mkdir -p /usr/src/app/.pnpm-store mkdir -p /workspaces/immich/node_modules && \
mkdir -p /workspaces/immich/web/node_modules && \
mkdir -p /workspaces/immich/web/.svelte-kit && \
mkdir -p /workspaces/immich/web/coverage && \
mkdir -p /workspaces/immich/.pnpm-store && \
mkdir -p /workspaces/immich/.github/node_modules && \
mkdir -p /workspaces/immich/docs/node_modules && \
mkdir -p /workspaces/immich/e2e/node_modules && \
mkdir -p /workspaces/immich/open-api/typescript-sdk/node_modules && \
mkdir -p /workspaces/immich/cli/node_modules
ENV PATH="${PATH}:/usr/src/app/server/bin" \ ENV PATH="${PATH}:/usr/src/app/server/bin" \
IMMICH_ENV=development \ IMMICH_ENV=development \
@ -27,14 +36,21 @@ RUN apt-get update && \
vim nano \ vim nano \
-y --no-install-recommends --fix-missing -y --no-install-recommends --fix-missing
RUN usermod -aG sudo node RUN usermod -aG sudo node && \
RUN echo "node ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers echo "node ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
RUN mkdir -p /workspaces/immich echo "umask 000" | tee /etc/profile /etc/bash.bashrc >/dev/null && \
umask 000 && mkdir -p /workspaces/immich && \
mkdir -p /workspaces/immich/.pnpm-store
COPY --chmod=777 ../.devcontainer/server/*.sh /immich-devcontainer/ COPY --chmod=777 ../.devcontainer/server/*.sh /immich-devcontainer/
COPY .. /tmp/create-dep-cache/ COPY ./package* ./pnpm* .pnpmfile.cjs /tmp/create-dep-cache/
COPY ./web/package* ./web/pnpm* /tmp/create-dep-cache/web/
COPY ./server/package* ./server/pnpm* /tmp/create-dep-cache/server/
COPY ./open-api/typescript-sdk/package* ./open-api/typescript-sdk/pnpm* /tmp/create-dep-cache/open-api/typescript-sdk/
WORKDIR /tmp/create-dep-cache WORKDIR /tmp/create-dep-cache
RUN make setup-server-dev setup-web-dev && rm -rf /tmp/create-dep-cache RUN umask 000 && pnpm fetch && rm -rf /tmp/create-dep-cache
WORKDIR /workspaces/immich
FROM dev-container-server AS dev-container-mobile FROM dev-container-server AS dev-container-mobile