diff --git a/docker-compose.yml b/docker-compose.yml index 7777301..3046c8a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,16 +8,9 @@ services: app: build: context: . + dockerfile: docker/prod.Dockerfile ports: - ${APP_PORT:-80}:80 -# args: -# WWW_USER: '${WWW_USER}' -# WWW_GROUP: '${WWW_GROUP}' -# networks: -# - app -# volumes: -# - '.:/var/www' -# user: '${WWW_USER}' # mysql: # image: 'mysql:8.0' diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile deleted file mode 100644 index 615f711..0000000 --- a/docker/app/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM php:8.1-fpm - -ARG WWW_USER -ARG WWW_GROUP -ARG NODE_VERSION=16 - -# Set working directory -WORKDIR /var/www - -# Install system dependencies -RUN apt-get update && apt-get install -y \ - git \ - curl \ - libpng-dev \ - libjpeg-dev \ - libfreetype6-dev \ - libonig-dev \ - libxml2-dev \ - libpq-dev \ - libzip-dev \ - libcurl4-openssl-dev \ - zip \ - unzip \ - default-mysql-client - -# Enable xdebug -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug - -# Install PHP extensions -RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install pdo pdo_mysql mbstring exif pcntl bcmath gd zip curl intl - -# Get latest Composer -RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer - -# Install Yarn -RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ - && apt-get install -y nodejs \ - && npm install -g npm - -# Clean cache -RUN apt-get -y autoremove \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Create user -RUN groupadd --force -g $WWW_GROUP webapp -RUN useradd -ms /bin/bash --no-user-group -g $WWW_GROUP -u $WWW_USER webapp diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile deleted file mode 100644 index 505e14d..0000000 --- a/docker/nginx/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM nginx:alpine - -# Add vhost config -ADD ./vhost.conf /etc/nginx/conf.d/default.conf diff --git a/docker/nginx/vhost.conf b/docker/nginx/vhost.conf deleted file mode 100644 index b5c51fa..0000000 --- a/docker/nginx/vhost.conf +++ /dev/null @@ -1,19 +0,0 @@ -server { - listen 80; - index index.php index.html; - root /var/www/public; - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - location / { - try_files $uri /index.php?$args; - } - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass app:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } -} diff --git a/Dockerfile b/docker/prod.Dockerfile similarity index 96% rename from Dockerfile rename to docker/prod.Dockerfile index 23c218d..7c5ebd3 100644 --- a/Dockerfile +++ b/docker/prod.Dockerfile @@ -58,7 +58,7 @@ RUN apt-get update && apt-get install -y \ default-mysql-client # Copy vhost config -COPY vhost.conf /etc/apache2/sites-available/000-default.conf +COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf # Enable Apache mods RUN a2enmod rewrite diff --git a/vhost.conf b/docker/vhost.conf similarity index 100% rename from vhost.conf rename to docker/vhost.conf