From 7e586a273a556f4b8dcd2c4fe0a4362ce0f7f155 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Tue, 25 May 2021 13:37:53 -0400 Subject: [PATCH] File/dir ownership in container --- Dockerfile | 2 ++ docker-compose.local.yml | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 docker-compose.local.yml diff --git a/Dockerfile b/Dockerfile index 824fcd5a..443fd65d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,6 @@ RUN php composer.phar install \ --no-scripts \ --prefer-dist +RUN chown -R www-data:www-data /var/www + EXPOSE 9000 diff --git a/docker-compose.local.yml b/docker-compose.local.yml new file mode 100644 index 00000000..597c2762 --- /dev/null +++ b/docker-compose.local.yml @@ -0,0 +1,62 @@ +--- +version: '3' +services: + app: + # For your own docker-compose, use `image: phpvms:latest` instead of the build/context block + build: + context: . + environment: + DB_HOST: mysql + REDIS_HOST: redis + volumes: + # Uncomment this line if you want to use this for local testing + - ./:/var/www + - ./resources/docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf + depends_on: + - mysql + - redis + + nginx: + image: nginx:1.15.12-alpine + command: /bin/sh -c "exec nginx -g 'daemon off;'" + volumes: + - ./:/var/www + - ./resources/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf + ports: + - 80:80 + depends_on: + - app + + mysql: + image: mysql:5.7 + command: "--innodb_use_native_aio=0" + environment: + MYSQL_DATABASE: phpvms + MYSQL_USER: phpvms + MYSQL_PASSWORD: phpvms + MYSQL_ROOT_PASSWORD: + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + volumes: + - ./storage/docker/mysql:/var/lib/mysql + - ./resources/docker/mysql:/etc/mysql/conf.d + ports: + - 3306:3306 + + redis: + image: redis:5.0.4-alpine + command: ["redis-server", "--appendonly", "yes"] + volumes: + - ./storage/docker/redis:/data + ports: + - 6379:6379 + restart: always + + # Use this to tail the logs so it's just all in a single window + #logs: + # image: busybox + # command: tail -f -F -n 0 /var/www/storage/logs/laravel.log + # restart: always + # volumes: + # - ./storage:/var/www/storage + # depends_on: + # - app