File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ up: ## Up the dev environment
2626down : # # Down the dev environment
2727 $(DOCKER_COMPOSE_DEV ) down --remove-orphans
2828
29+ clear : # # Remove development docker containers and volumes
30+ $(DOCKER_COMPOSE_DEV ) down --volumes --remove-orphans
31+
2932shell : # # Get into container shell
3033 $(DOCKER_COMPOSE_DEV ) exec app /bin/sh
3134
Original file line number Diff line number Diff line change @@ -24,10 +24,25 @@ RUN install-php-extensions \
2424#
2525
2626FROM base AS dev
27+ ARG USER_ID=10001
28+ ARG GROUP_ID=10001
29+ ARG USER_NAME=www-data
30+ ARG GROUP_NAME=www-data
31+
2732RUN install-php-extensions \
2833 xdebug
34+
2935COPY --from=composer /composer /usr/bin/composer
30- USER www-data
36+
37+ # Based on https://frankenphp.dev/docs/docker/#running-as-a-non-root-user
38+ RUN \
39+ groupadd --gid ${GROUP_ID} ${GROUP_NAME}; \
40+ useradd --gid ${GROUP_ID} --uid ${USER_ID} ${GROUP_NAME}; \
41+ # Add additional capability to bind to port 80 and 443
42+ setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \
43+ # Give write access to /data/caddy and /config/caddy
44+ chown -R ${USER_NAME}:${GROUP_NAME} /data/caddy && chown -R ${USER_NAME}:${GROUP_NAME} /config/caddy
45+ USER ${USER_NAME}
3146
3247#
3348# Production
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ services:
44 dockerfile : docker/Dockerfile
55 context : ..
66 target : dev
7- user : ${UID}:${GID}
7+ args :
8+ USER_ID : ${UID}
9+ GROUP_ID : ${GID}
810 environment :
911 XDEBUG_MODE : " ${XDEBUG_MODE:-develop}"
1012 APP_ENV : " ${APP_ENV:-dev}"
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ services:
44 dockerfile : docker/Dockerfile
55 context : ..
66 target : dev
7- user : ${UID}:${GID}
7+ args :
8+ USER_ID : ${UID}
9+ GROUP_ID : ${GID}
810 environment :
911 XDEBUG_MODE : " off"
1012 APP_ENV : " test"
You can’t perform that action at this time.
0 commit comments