mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 08:49:01 +03:00
fix: development containers init race conditions
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.8.0",
|
||||
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||
"@immich/sdk": "workspace:*",
|
||||
"@types/byte-size": "^8.1.0",
|
||||
"@types/cli-progress": "^3.11.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
|
||||
@@ -14,6 +14,48 @@
|
||||
name: immich-dev
|
||||
|
||||
services:
|
||||
immich-init:
|
||||
container_name: immich_init
|
||||
image: immich-server-dev:latest
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: server/Dockerfile.dev
|
||||
target: dev
|
||||
command:
|
||||
- |
|
||||
rm -f /tmp/init-complete
|
||||
|
||||
if [ -d "node_modules/.pnpm" ] && [ "$(ls -A node_modules/.pnpm 2>/dev/null)" ] && [ -f "pnpm-lock.yaml" ] && pnpm list --silent &>/dev/null; then
|
||||
echo "Dependencies valid, skipping install"
|
||||
else
|
||||
echo "Installing dependencies..."
|
||||
pnpm install
|
||||
fi
|
||||
|
||||
touch /tmp/init-complete
|
||||
exec tail -f /dev/null
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-server:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
- cli-node_modules:/usr/src/app/cli/node_modules
|
||||
- docs-node_modules:/usr/src/app/docs/node_modules
|
||||
- e2e-node_modules:/usr/src/app/e2e/node_modules
|
||||
- sdk-node_modules:/usr/src/app/open-api/typescript-sdk/node_modules
|
||||
- app-node_modules:/usr/src/app/node_modules
|
||||
- sveltekit:/usr/src/app/web/.svelte-kit
|
||||
- coverage:/usr/src/app/web/coverage
|
||||
restart: 'no'
|
||||
healthcheck:
|
||||
test: ['CMD', 'test', '-f', '/tmp/init-complete']
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 300
|
||||
start_period: 300s
|
||||
|
||||
immich-server:
|
||||
container_name: immich_server
|
||||
command: ['immich-dev']
|
||||
@@ -29,8 +71,11 @@ services:
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
- ${UPLOAD_LOCATION}/photos:/data
|
||||
- /LUNA/ALPHA/PERSONAL/git/immich-dev/flickr-search/downloads:/ext-lib
|
||||
- /LUNA/ALPHA/PERSONAL/git/immich-dev/wikimedia-search/downloads:/ext-lib2
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- pnpm-store:/usr/src/app/.pnpm-store
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-server:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
@@ -63,6 +108,8 @@ services:
|
||||
- 9231:9231
|
||||
- 2283:2283
|
||||
depends_on:
|
||||
immich-init:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
database:
|
||||
@@ -85,7 +132,8 @@ services:
|
||||
- 24678:24678
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
- pnpm-store:/usr/src/app/.pnpm-store
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-web:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
@@ -98,6 +146,8 @@ services:
|
||||
- coverage:/usr/src/app/web/coverage
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
immich-init:
|
||||
condition: service_healthy
|
||||
immich-server:
|
||||
condition: service_started
|
||||
|
||||
@@ -173,7 +223,9 @@ volumes:
|
||||
model-cache:
|
||||
prometheus-data:
|
||||
grafana-data:
|
||||
pnpm-store:
|
||||
pnpm-cache:
|
||||
pnpm-store-server:
|
||||
pnpm-store-web:
|
||||
server-node_modules:
|
||||
web-node_modules:
|
||||
github-node_modules:
|
||||
|
||||
@@ -1,6 +1,55 @@
|
||||
name: immich-e2e
|
||||
|
||||
services:
|
||||
immich-init:
|
||||
container_name: immich-e2e-init
|
||||
image: immich-server-dev:latest
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: server/Dockerfile.dev
|
||||
target: dev
|
||||
command:
|
||||
- |
|
||||
set -x
|
||||
echo "Init container starting"
|
||||
rm -f /tmp/init-complete
|
||||
|
||||
echo "Checking for existing dependencies"
|
||||
if [ -d "node_modules/.pnpm" ] && [ "$(ls -A node_modules/.pnpm 2>/dev/null)" ] && [ -f "pnpm-lock.yaml" ] && pnpm list --silent &>/dev/null; then
|
||||
echo "Dependencies valid, skipping install"
|
||||
else
|
||||
echo "Installing dependencies"
|
||||
pnpm install
|
||||
echo "Dependencies installed successfully"
|
||||
fi
|
||||
|
||||
echo "Creating init-complete signal file"
|
||||
touch /tmp/init-complete
|
||||
echo "Init complete, keeping container alive"
|
||||
|
||||
exec tail -f /dev/null
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-server:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
- cli-node_modules:/usr/src/app/cli/node_modules
|
||||
- docs-node_modules:/usr/src/app/docs/node_modules
|
||||
- e2e-node_modules:/usr/src/app/e2e/node_modules
|
||||
- sdk-node_modules:/usr/src/app/open-api/typescript-sdk/node_modules
|
||||
- app-node_modules:/usr/src/app/node_modules
|
||||
- sveltekit:/usr/src/app/web/.svelte-kit
|
||||
- coverage:/usr/src/app/web/coverage
|
||||
restart: 'no'
|
||||
healthcheck:
|
||||
test: ['CMD', 'test', '-f', '/tmp/init-complete']
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
retries: 300
|
||||
start_period: 300s
|
||||
|
||||
immich-server:
|
||||
container_name: immich-e2e-server
|
||||
command: ['immich-dev']
|
||||
@@ -24,7 +73,8 @@ services:
|
||||
- ..:/usr/src/app
|
||||
- ${UPLOAD_LOCATION}/photos:/data
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- pnpm-store:/usr/src/app/.pnpm-store
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-server:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
@@ -37,6 +87,8 @@ services:
|
||||
- coverage:/usr/src/app/web/coverage
|
||||
- ../plugins:/build/corePlugin
|
||||
depends_on:
|
||||
immich-init:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
database:
|
||||
@@ -56,7 +108,8 @@ services:
|
||||
- IMMICH_SERVER_URL=http://immich-server:2285/
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
- pnpm-store:/usr/src/app/.pnpm-store
|
||||
- pnpm-cache:/buildcache/pnpm-cache
|
||||
- pnpm-store-web:/buildcache/pnpm-store
|
||||
- server-node_modules:/usr/src/app/server/node_modules
|
||||
- web-node_modules:/usr/src/app/web/node_modules
|
||||
- github-node_modules:/usr/src/app/.github/node_modules
|
||||
@@ -67,6 +120,9 @@ services:
|
||||
- app-node_modules:/usr/src/app/node_modules
|
||||
- sveltekit:/usr/src/app/web/.svelte-kit
|
||||
- coverage:/usr/src/app/web/coverage
|
||||
depends_on:
|
||||
immich-init:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
@@ -92,7 +148,9 @@ volumes:
|
||||
model-cache:
|
||||
prometheus-data:
|
||||
grafana-data:
|
||||
pnpm-store:
|
||||
pnpm-cache:
|
||||
pnpm-store-server:
|
||||
pnpm-store-web:
|
||||
server-node_modules:
|
||||
web-node_modules:
|
||||
github-node_modules:
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.8.0",
|
||||
"@faker-js/faker": "^10.1.0",
|
||||
"@immich/cli": "file:../cli",
|
||||
"@immich/e2e-auth-server": "file:../e2e-auth-server",
|
||||
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||
"@immich/cli": "workspace:*",
|
||||
"@immich/e2e-auth-server": "workspace:*",
|
||||
"@immich/sdk": "workspace:*",
|
||||
"@playwright/test": "^1.44.1",
|
||||
"@socket.io/component-emitter": "^3.1.2",
|
||||
"@types/luxon": "^3.4.2",
|
||||
|
||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -45,7 +45,7 @@ importers:
|
||||
specifier: ^9.8.0
|
||||
version: 9.39.2
|
||||
'@immich/sdk':
|
||||
specifier: file:../open-api/typescript-sdk
|
||||
specifier: workspace:*
|
||||
version: link:../open-api/typescript-sdk
|
||||
'@types/byte-size':
|
||||
specifier: ^8.1.0
|
||||
@@ -202,13 +202,13 @@ importers:
|
||||
specifier: ^10.1.0
|
||||
version: 10.2.0
|
||||
'@immich/cli':
|
||||
specifier: file:../cli
|
||||
specifier: workspace:*
|
||||
version: link:../cli
|
||||
'@immich/e2e-auth-server':
|
||||
specifier: file:../e2e-auth-server
|
||||
specifier: workspace:*
|
||||
version: link:../e2e-auth-server
|
||||
'@immich/sdk':
|
||||
specifier: file:../open-api/typescript-sdk
|
||||
specifier: workspace:*
|
||||
version: link:../open-api/typescript-sdk
|
||||
'@playwright/test':
|
||||
specifier: ^1.44.1
|
||||
@@ -738,7 +738,7 @@ importers:
|
||||
specifier: ^0.4.3
|
||||
version: 0.4.3
|
||||
'@immich/sdk':
|
||||
specifier: file:../open-api/typescript-sdk
|
||||
specifier: workspace:*
|
||||
version: link:../open-api/typescript-sdk
|
||||
'@immich/ui':
|
||||
specifier: ^0.59.0
|
||||
|
||||
@@ -3,19 +3,19 @@ FROM ghcr.io/immich-app/base-server-dev:202601131104@sha256:8d907eb3fe10dba4a1e0
|
||||
|
||||
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
|
||||
CI=1 \
|
||||
COREPACK_HOME=/tmp
|
||||
COREPACK_HOME=/tmp \
|
||||
PNPM_HOME=/buildcache/pnpm-store
|
||||
|
||||
RUN npm install --global corepack@latest && \
|
||||
corepack enable pnpm && \
|
||||
echo "devdir=/buildcache/node-gyp" >> /usr/local/etc/npmrc && \
|
||||
echo "store-dir=/buildcache/pnpm-store" >> /usr/local/etc/npmrc && \
|
||||
echo "devdir=/buildcache/node-gyp" >> /usr/local/etc/npmrc
|
||||
echo "cache-dir=/buildcache/pnpm-cache" >> /usr/local/etc/npmrc && \
|
||||
echo "# Retry configuration - default is 2" >> /usr/local/etc/npmrc && \
|
||||
echo "fetch-retries=5" >> /usr/local/etc/npmrc && \
|
||||
mkdir -p /buildcache/pnpm-store /buildcache/pnpm-cache /buildcache/node-gyp && \
|
||||
chmod -R o+rw /buildcache
|
||||
|
||||
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
|
||||
RUN pnpm fetch && rm -rf /tmp/create-dep-cache && chmod -R o+rw /buildcache
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
ENV PATH="${PATH}:/usr/src/app/server/bin:/usr/src/app/web/bin" \
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"@formatjs/icu-messageformat-parser": "^3.0.0",
|
||||
"@immich/justified-layout-wasm": "^0.4.3",
|
||||
"@immich/sdk": "file:../open-api/typescript-sdk",
|
||||
"@immich/sdk": "workspace:*",
|
||||
"@immich/ui": "^0.59.0",
|
||||
"@mapbox/mapbox-gl-rtl-text": "0.2.3",
|
||||
"@mdi/js": "^7.4.47",
|
||||
|
||||
Reference in New Issue
Block a user