Fix wrongly configured Docker volumes
MODIFY
Dockerfile
Dockerfile
FROM php:7.2-fpm
+# Install system packages (Git, packages for archives, Node.js)
+RUN apt-get update \
+ && apt-get install -y git libzip-dev zlib1g-dev unzip \
+ && curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs \
+ && rm -rf /var/lib/apt/lists/*
+
# Install PHP extensions
-RUN docker-php-ext-install pdo_mysql && docker-php-ext-install calendar
+RUN docker-php-ext-install pdo_mysql && docker-php-ext-install zip && docker-php-ext-install calendar
# Ensure commands are running successfully before continuing
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -9,18 +15,17 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
-# Install system packages (Git, Node.js)
-RUN apt-get update \
- && apt-get install -y git \
- && curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs \
- && rm -rf /var/lib/apt/lists/*
-
# Install Yarn
RUN npm install -g yarn
WORKDIR /usr/share/nginx/budget
COPY . .
+# Required before we're able to run any "php artisan" commands
+RUN composer install
+
RUN php artisan budget:install
+RUN chown -R www-data:www-data /usr/share/nginx/budget
+
CMD ./docker_boot.sh

MODIFY
docker-compose.yml
docker-compose.yml
@@ -2,6 +2,7 @@ version: '3'
volumes:
database2: {}
+ built_app: {}
services:
# Named "database2" because "database" conflicts with directory inside project
@@ -24,12 +25,14 @@ services:
DB_USERNAME: budget
DB_PASSWORD: test
volumes:
- - ./:/usr/share/nginx/budget
+ - built_app:/usr/share/nginx/budget
nginx:
image: nginx:latest
+ depends_on:
+ - php # To ensure that "built_app" volume gets filled by "php" service
volumes:
- - ./:/usr/share/nginx/budget
+ - built_app:/usr/share/nginx/budget
- ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- 8080:80

Fix wrongly configured Docker volumes