Skip to content

Commit

Permalink
ホストのユーザーの UID と GID を www-data にマッピングする
Browse files Browse the repository at this point in the history
以下のように docker-compose コマンドを実行することで、ホストのユーザー
の UID 及び GID を www-data ユーザーにマッピングできる

```
UID=${UID} GID=${GID} docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
```
  • Loading branch information
nanasess committed Sep 7, 2022
1 parent 01ff147 commit eb851f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ version: '3'

services:
ec-cube:
environment:
USER_ID: ${UID:-}
GROUP_ID: ${GID:-}
volumes:
- ".:/var/www/html:cached"
7 changes: 7 additions & 0 deletions dockerbuild/docker-php-entrypoint
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/sh
set -e

if [ -n "${USER_ID}" ]; then
usermod -u ${USER_ID} -o www-data
fi
if [ -n "${GROUP_ID}" ]; then
groupmod -g ${GROUP_ID} www-data
fi

if [ ! -d /var/www/html/vendor/bin ]; then
composer install \
--no-scripts \
Expand Down

0 comments on commit eb851f6

Please sign in to comment.