Skip to content

Commit

Permalink
🐋 Fix Docker to work with user ID <> 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
jmleroux committed Jan 23, 2025
1 parent 534dc93 commit fdf8282
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor
bin/phpspec
bin/php-cs-fixer
composer.lock
.composer
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM php:8.1-cli

ARG DEV_UID=1000

RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' > /etc/apt/apt.conf.d/01-no-recommended && \
echo 'path-exclude=/usr/share/man/*' > /etc/dpkg/dpkg.cfg.d/path_exclusions && \
echo 'path-exclude=/usr/share/doc/*' >> /etc/dpkg/dpkg.cfg.d/path_exclusions && \
Expand All @@ -12,3 +14,5 @@ RUN echo 'APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;' > /etc/apt/
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

RUN useradd -u ${DEV_UID} appuser || echo "User exists" && usermod --uid ${DEV_UID} -d /opt/app appuser
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ services:
volumes:
- ./:/opt/app
working_dir: /opt/app
user: appuser

0 comments on commit fdf8282

Please sign in to comment.