Skip to content

Commit 89c84cc

Browse files
committed
Update docker permissions (dev)
1 parent aee3b5f commit 89c84cc

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

docker/docker-compose.dev.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
- /etc/localtime:/etc/localtime:ro
3636
env_file:
3737
- .env
38+
user: ${S_UID:-0}:${S_GID:-0}
3839
environment:
3940
IMMICH_REPOSITORY: immich-app/immich
4041
IMMICH_REPOSITORY_URL: https://github.com/immich-app/immich
@@ -66,8 +67,8 @@ services:
6667
immich-web:
6768
container_name: immich_web
6869
image: immich-web-dev:latest
69-
# Needed for rootless docker setup, see https://github.com/moby/moby/issues/45919
70-
# user: 0:0
70+
# user: 0:0 needed for rootless docker setup, see https://github.com/moby/moby/issues/45919
71+
user: ${W_UID:-1000}:${W_GID:-1000}
7172
build:
7273
context: ../
7374
dockerfile: web/Dockerfile

server/Dockerfile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ FROM ghcr.io/immich-app/base-server-dev:202507091427@sha256:733e510024e03bc24506
44
WORKDIR /usr/src/app
55
COPY ./server/package* ./server/
66
WORKDIR /usr/src/app/server
7-
RUN npm ci && \
7+
RUN echo "umask 000" >> /etc/profile && \
8+
echo "umask 000" >> /etc/bash.bashrc && \
9+
umask 000 && \
10+
chmod o+wx /usr/src/app && \
11+
chmod o+wx /usr/src/app/server && \
12+
npm ci && \
813
# exiftool-vendored.pl, sharp-linux-x64 and sharp-linux-arm64 are the only ones we need
914
# they're marked as optional dependencies, so we need to copy them manually after pruning
1015
rm -rf node_modules/@img/sharp-libvips* && \
@@ -26,17 +31,14 @@ RUN apt-get update && \
2631
RUN usermod -aG sudo node
2732
RUN echo "node ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
2833
RUN mkdir -p /workspaces/immich
29-
RUN chown node -R /workspaces
30-
COPY --chown=node:node --chmod=777 ../.devcontainer/server/*.sh /immich-devcontainer/
34+
COPY --chmod=777 ../.devcontainer/server/*.sh /immich-devcontainer/
3135

32-
USER node
33-
COPY --chown=node:node .. /tmp/create-dep-cache/
36+
COPY .. /tmp/create-dep-cache/
3437
WORKDIR /tmp/create-dep-cache
3538
RUN make ci-all && rm -rf /tmp/create-dep-cache
3639

37-
3840
FROM dev-container-server AS dev-container-mobile
39-
USER root
41+
4042
# Enable multiarch for arm64 if necessary
4143
RUN if [ "$(dpkg --print-architecture)" = "arm64" ]; then \
4244
dpkg --add-architecture amd64 && \
@@ -62,7 +64,6 @@ RUN mkdir -p ${FLUTTER_HOME} \
6264
&& rm flutter.tar.xz \
6365
&& chown -R node ${FLUTTER_HOME}
6466

65-
USER node
6667
RUN sudo apt-get update \
6768
&& wget -qO- https://dcm.dev/pgp-key.public | sudo gpg --dearmor -o /usr/share/keyrings/dcm.gpg \
6869
&& echo 'deb [signed-by=/usr/share/keyrings/dcm.gpg arch=amd64] https://dcm.dev/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list \

web/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ COPY --chown=node:node ./open-api ./open-api/
99
COPY --chown=node:node Makefile ./
1010

1111
WORKDIR /usr/src/app/web
12-
RUN npm ci
12+
RUN umask 000 && \
13+
find /usr/src/app -type d -exec chmod o+rwx {} \; && \
14+
find /usr/src/app -type f -exec chmod o+rw {} \; && \
15+
npm ci
1316

1417
ENV CHOKIDAR_USEPOLLING=true
1518
EXPOSE 24678

0 commit comments

Comments
 (0)