mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 01:29:04 +03:00
fix: align devcontainers with standard development containers (#26321)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
"name": "Immich - Backend, Frontend and ML",
|
"name": "Immich - Backend, Frontend and ML",
|
||||||
"service": "immich-server",
|
"service": "immich-server",
|
||||||
"runServices": [
|
"runServices": [
|
||||||
|
"immich-init",
|
||||||
"immich-server",
|
"immich-server",
|
||||||
"redis",
|
"redis",
|
||||||
"database",
|
"database",
|
||||||
@@ -31,29 +32,8 @@
|
|||||||
"tasks": {
|
"tasks": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
|
||||||
"label": "Fix Permissions, Install Dependencies",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "[ -f /immich-devcontainer/container-start.sh ] && /immich-devcontainer/container-start.sh || exit 0",
|
|
||||||
"isBackground": true,
|
|
||||||
"presentation": {
|
|
||||||
"echo": true,
|
|
||||||
"reveal": "always",
|
|
||||||
"focus": false,
|
|
||||||
"panel": "dedicated",
|
|
||||||
"showReuseMessage": true,
|
|
||||||
"clear": false,
|
|
||||||
"group": "Devcontainer tasks",
|
|
||||||
"close": true
|
|
||||||
},
|
|
||||||
"runOptions": {
|
|
||||||
"runOn": "default"
|
|
||||||
},
|
|
||||||
"problemMatcher": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Immich API Server (Nest)",
|
"label": "Immich API Server (Nest)",
|
||||||
"dependsOn": ["Fix Permissions, Install Dependencies"],
|
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "[ -f /immich-devcontainer/container-start-backend.sh ] && /immich-devcontainer/container-start-backend.sh || exit 0",
|
"command": "[ -f /immich-devcontainer/container-start-backend.sh ] && /immich-devcontainer/container-start-backend.sh || exit 0",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
@@ -74,7 +54,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Immich Web Server (Vite)",
|
"label": "Immich Web Server (Vite)",
|
||||||
"dependsOn": ["Fix Permissions, Install Dependencies"],
|
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "[ -f /immich-devcontainer/container-start-frontend.sh ] && /immich-devcontainer/container-start-frontend.sh || exit 0",
|
"command": "[ -f /immich-devcontainer/container-start-frontend.sh ] && /immich-devcontainer/container-start-frontend.sh || exit 0",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
@@ -130,8 +109,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"overrideCommand": true,
|
"overrideCommand": true,
|
||||||
"workspaceFolder": "/workspaces/immich",
|
"workspaceFolder": "/usr/src/app",
|
||||||
"remoteUser": "node",
|
"remoteUser": "root",
|
||||||
"userEnvProbe": "loginInteractiveShell",
|
"userEnvProbe": "loginInteractiveShell",
|
||||||
"remoteEnv": {
|
"remoteEnv": {
|
||||||
// The location where your uploaded files are stored
|
// The location where your uploaded files are stored
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
services:
|
services:
|
||||||
|
immich-app-base:
|
||||||
|
image: busybox
|
||||||
immich-server:
|
immich-server:
|
||||||
|
extends:
|
||||||
|
service: immich-app-base
|
||||||
|
profiles: !reset []
|
||||||
|
image: immich-server-dev:latest
|
||||||
build:
|
build:
|
||||||
target: dev-container-mobile
|
target: dev-container-mobile
|
||||||
environment:
|
environment:
|
||||||
- IMMICH_SERVER_URL=http://127.0.0.1:2283/
|
- IMMICH_SERVER_URL=http://127.0.0.1:2283/
|
||||||
volumes: !override # bind mount host to /workspaces/immich
|
volumes:
|
||||||
- ..:/workspaces/immich
|
|
||||||
- ${UPLOAD_LOCATION:-upload-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/data
|
- ${UPLOAD_LOCATION:-upload-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/data
|
||||||
- pnpm-store:/usr/src/app/.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
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
immich-web:
|
immich-web:
|
||||||
env_file: !reset []
|
env_file: !reset []
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "Immich - Mobile",
|
"name": "Immich - Mobile",
|
||||||
"service": "immich-server",
|
"service": "immich-server",
|
||||||
"runServices": [
|
"runServices": [
|
||||||
|
"immich-init",
|
||||||
"immich-server",
|
"immich-server",
|
||||||
"redis",
|
"redis",
|
||||||
"database",
|
"database",
|
||||||
@@ -35,7 +36,7 @@
|
|||||||
},
|
},
|
||||||
"forwardPorts": [],
|
"forwardPorts": [],
|
||||||
"overrideCommand": true,
|
"overrideCommand": true,
|
||||||
"workspaceFolder": "/workspaces/immich",
|
"workspaceFolder": "/usr/src/app",
|
||||||
"remoteUser": "node",
|
"remoteUser": "node",
|
||||||
"userEnvProbe": "loginInteractiveShell",
|
"userEnvProbe": "loginInteractiveShell",
|
||||||
"remoteEnv": {
|
"remoteEnv": {
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
export IMMICH_PORT="${DEV_SERVER_PORT:-2283}"
|
export IMMICH_PORT="${DEV_SERVER_PORT:-2283}"
|
||||||
export DEV_PORT="${DEV_PORT:-3000}"
|
export DEV_PORT="${DEV_PORT:-3000}"
|
||||||
|
|
||||||
# search for immich directory inside workspace.
|
|
||||||
# /workspaces/immich is the bind mount, but other directories can be mounted if runing
|
|
||||||
# Devcontainer: Clone [repository|pull request] in container volumne
|
|
||||||
WORKSPACES_DIR="/workspaces"
|
|
||||||
IMMICH_DIR="$WORKSPACES_DIR/immich"
|
|
||||||
IMMICH_DEVCONTAINER_LOG="$HOME/immich-devcontainer.log"
|
IMMICH_DEVCONTAINER_LOG="$HOME/immich-devcontainer.log"
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
@@ -30,52 +25,8 @@ run_cmd() {
|
|||||||
return "${PIPESTATUS[0]}"
|
return "${PIPESTATUS[0]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find directories excluding /workspaces/immich
|
export IMMICH_WORKSPACE="/usr/src/app"
|
||||||
mapfile -t other_dirs < <(find "$WORKSPACES_DIR" -mindepth 1 -maxdepth 1 -type d ! -path "$IMMICH_DIR" ! -name ".*")
|
|
||||||
|
|
||||||
if [ ${#other_dirs[@]} -gt 1 ]; then
|
|
||||||
log "Error: More than one directory found in $WORKSPACES_DIR other than $IMMICH_DIR."
|
|
||||||
exit 1
|
|
||||||
elif [ ${#other_dirs[@]} -eq 1 ]; then
|
|
||||||
export IMMICH_WORKSPACE="${other_dirs[0]}"
|
|
||||||
else
|
|
||||||
export IMMICH_WORKSPACE="$IMMICH_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "Found immich workspace in $IMMICH_WORKSPACE"
|
log "Found immich workspace in $IMMICH_WORKSPACE"
|
||||||
log ""
|
log ""
|
||||||
|
|
||||||
fix_permissions() {
|
|
||||||
|
|
||||||
log "Fixing permissions for ${IMMICH_WORKSPACE}"
|
|
||||||
|
|
||||||
# Change ownership for directories that exist
|
|
||||||
for dir in "${IMMICH_WORKSPACE}/.vscode" \
|
|
||||||
"${IMMICH_WORKSPACE}/server/upload" \
|
|
||||||
"${IMMICH_WORKSPACE}/.pnpm-store" \
|
|
||||||
"${IMMICH_WORKSPACE}/.github/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/cli/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/e2e/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/open-api/typescript-sdk/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/server/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/server/dist" \
|
|
||||||
"${IMMICH_WORKSPACE}/web/node_modules" \
|
|
||||||
"${IMMICH_WORKSPACE}/web/dist"; do
|
|
||||||
if [ -d "$dir" ]; then
|
|
||||||
run_cmd sudo chown node -R "$dir"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
log ""
|
|
||||||
}
|
|
||||||
|
|
||||||
install_dependencies() {
|
|
||||||
|
|
||||||
log "Installing dependencies"
|
|
||||||
(
|
|
||||||
cd "${IMMICH_WORKSPACE}" || exit 1
|
|
||||||
export CI=1 FROZEN=1 OFFLINE=1
|
|
||||||
run_cmd make setup-web-dev setup-server-dev
|
|
||||||
)
|
|
||||||
log ""
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
services:
|
services:
|
||||||
|
immich-app-base:
|
||||||
|
image: busybox
|
||||||
immich-server:
|
immich-server:
|
||||||
|
extends:
|
||||||
|
service: immich-app-base
|
||||||
|
profiles: !reset []
|
||||||
|
image: immich-server-dev:latest
|
||||||
build:
|
build:
|
||||||
target: dev-container-server
|
target: dev-container-server
|
||||||
env_file: !reset []
|
env_file: !reset []
|
||||||
hostname: immich-dev
|
hostname: immich-dev
|
||||||
environment:
|
environment:
|
||||||
- IMMICH_SERVER_URL=http://127.0.0.1:2283/
|
- IMMICH_SERVER_URL=http://127.0.0.1:2283/
|
||||||
volumes: !override
|
volumes:
|
||||||
- ..:/workspaces/immich
|
|
||||||
- ${UPLOAD_LOCATION:-upload-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/data
|
- ${UPLOAD_LOCATION:-upload-devcontainer-volume}${UPLOAD_LOCATION:+/photos}:/data
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- pnpm-store:/usr/src/app/.pnpm-store
|
- 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
|
|
||||||
- ../plugins:/build/corePlugin
|
- ../plugins:/build/corePlugin
|
||||||
immich-web:
|
immich-web:
|
||||||
env_file: !reset []
|
env_file: !reset []
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# shellcheck source=common.sh
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /immich-devcontainer/container-common.sh
|
|
||||||
|
|
||||||
log "Setting up Immich dev container..."
|
|
||||||
fix_permissions
|
|
||||||
|
|
||||||
log "Setup complete, please wait while backend and frontend services automatically start"
|
|
||||||
log
|
|
||||||
log "If necessary, the services may be manually started using"
|
|
||||||
log
|
|
||||||
log "$ /immich-devcontainer/container-start-backend.sh"
|
|
||||||
log "$ /immich-devcontainer/container-start-frontend.sh"
|
|
||||||
log
|
|
||||||
log "From different terminal windows, as these scripts automatically restart the server"
|
|
||||||
log "on error, and will continuously run in a loop"
|
|
||||||
@@ -27,16 +27,14 @@ ENTRYPOINT ["tini", "--", "/bin/bash", "-c"]
|
|||||||
FROM dev AS dev-container-server
|
FROM dev AS dev-container-server
|
||||||
|
|
||||||
RUN apt-get update --allow-releaseinfo-change && \
|
RUN apt-get update --allow-releaseinfo-change && \
|
||||||
apt-get install sudo inetutils-ping openjdk-21-jre-headless \
|
apt-get install inetutils-ping openjdk-21-jre-headless \
|
||||||
vim nano curl \
|
vim nano curl \
|
||||||
-y --no-install-recommends --fix-missing
|
-y --no-install-recommends --fix-missing
|
||||||
|
|
||||||
RUN usermod -aG sudo node && \
|
RUN mkdir -p /workspaces && \
|
||||||
echo "node ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
ln -s /usr/src/app /workspaces/immich
|
||||||
mkdir -p /workspaces/immich
|
|
||||||
|
|
||||||
RUN chown node:node -R /workspaces
|
COPY --chmod=755 ../.devcontainer/server/*.sh /immich-devcontainer/
|
||||||
COPY --chown=node:node --chmod=755 ../.devcontainer/server/*.sh /immich-devcontainer/
|
|
||||||
|
|
||||||
WORKDIR /workspaces/immich
|
WORKDIR /workspaces/immich
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user