Fixes root polluting owner:group in host files

This commit is contained in:
Carlos Monroy Fernández
2022-08-31 14:43:56 +02:00
committed by tλeUniC
parent 83fa0493e2
commit 197ceb1fde
3 changed files with 19 additions and 4 deletions

View File

@@ -21,4 +21,13 @@ FROM prod AS local
RUN apt-get -y install git httpie \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug
&& docker-php-ext-enable xdebug
ARG UID
ARG GID
RUN usermod -u $UID www-data \
&& groupmod -g $GID www-data \
&& chown www-data:www-data /var/www
USER $UID:$GID
WORKDIR /var/www/html

View File

@@ -1,6 +1,9 @@
# Run `make` (no arguments) to get a short description of what is available
# within this `Makefile`.
# Our user and group id used as default container user:group id. Avoid permissions pollution
UID := $(shell id -u)
GID := $(shell id -g)
export UID GID
# Default shell to use
SHELL := bash
@@ -92,4 +95,4 @@ deptrack: deps
.PHONY: shell
shell:
$(APP_SHELL) bash
$(APP_SHELL) bash

View File

@@ -14,9 +14,12 @@ services:
dockerfile: Dockerfile
context: .
target: local
args:
- UID=${UID:-}
- GID=${GID:-}
init: true
env_file: .env.docker.dist
ports:
- "8000:80"
volumes:
- ./:/var/www/html
- ./:/var/www/html