diff --git a/.gitignore b/.gitignore index 9b34cbea..00c3679e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ gox.iml rebuild_docker.sh docker/* db/* -docker-compose.yml package-lock.json public/* /public/* diff --git a/docker-setup/Dockerfile b/docker-setup/Dockerfile new file mode 100644 index 00000000..13ce0249 --- /dev/null +++ b/docker-setup/Dockerfile @@ -0,0 +1,28 @@ +FROM php:7.4-fpm + +WORKDIR /var/www/html + +RUN docker-php-ext-install pdo pdo_mysql + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libzip-dev \ + zip \ + cron \ + supervisor \ + nano \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd \ + && docker-php-ext-install zip \ + && docker-php-ext-install bcmath + +COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer + +#NODEJS & NPM +RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - +RUN apt-get -y install nodejs + +RUN chown -R www-data:www-data /var/www +RUN chmod 755 /var/www \ No newline at end of file diff --git a/docker-setup/docker-compose.yml b/docker-setup/docker-compose.yml new file mode 100644 index 00000000..cdfa1a66 --- /dev/null +++ b/docker-setup/docker-compose.yml @@ -0,0 +1,54 @@ +version: '3' + +networks: + shipping-portal-staging: + +services: + ################################################################# + nginx: + image: nginx:stable-alpine + container_name: shipping-portal-ngnix + ports: + - "8081:80" + volumes: + - ../:/var/www/html + - ./nginx/default.conf:/etc/nginx/conf.d/default.conf + depends_on: + - php + - mysql + networks: + - shipping-portal-staging + ################################################################# + mysql: + image: mysql:5.7.29 + container_name: shipping-portal-mysql + restart: unless-stopped + tty: true + ports: + - 3307:3306 + environment: + MYSQL_ROOT_USER: root + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: shipping-portal-db + MYSQL_USER: master + MYSQL_PASSWORD: cDe7gcrRBWetaAP + volumes: + - mysql-data:/var/lib/mysql + networks: + - shipping-portal-staging + ################################################################# + php: + build: + context: . + dockerfile: Dockerfile + container_name: shipping-portal-php + volumes: + - ../:/var/www/html + ports: + - "9001:9000" + networks: + - shipping-portal-staging + ################################################################# + +volumes: + mysql-data: diff --git a/docker-setup/nginx/default.conf b/docker-setup/nginx/default.conf new file mode 100644 index 00000000..8761015c --- /dev/null +++ b/docker-setup/nginx/default.conf @@ -0,0 +1,27 @@ +server { + listen 80; + index index.php index.html; + server_name localhost; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + root /var/www/html/public; + + server_name localhost; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_intercept_errors on; + fastcgi_keep_conn on; + fastcgi_param PHP_VALUE "auto_prepend_file= \n allow_url_include=Off"; + } +} \ No newline at end of file