kevin tessier 5 gadi atpakaļ
revīzija
ec68d24ac2
9 mainītis faili ar 167 papildinājumiem un 0 dzēšanām
  1. 4 0
      .env
  2. 5 0
      .gitignore
  3. 3 0
      Docker/nginx/Dockerfile
  4. 36 0
      Docker/nginx/default.conf
  5. 28 0
      Docker/php/Dockerfile
  6. 2 0
      Docker/php/php-custom.ini
  7. 58 0
      README.md
  8. 30 0
      docker-compose.yml
  9. 1 0
      src

+ 4 - 0
.env

@@ -0,0 +1,4 @@
+COMPOSE_PROJECT_NAME=kevintessier_grav
+
+PROJECT_ROOT=./src
+LOG_ROOT=./log

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+src/*
+log/*
+*.sql
+.DS_Store
+.directory

+ 3 - 0
Docker/nginx/Dockerfile

@@ -0,0 +1,3 @@
+FROM nginx:latest
+
+COPY ./default.conf /etc/nginx/conf.d/default.conf

+ 36 - 0
Docker/nginx/default.conf

@@ -0,0 +1,36 @@
+server {
+    listen 80 default_server;
+    root /var/www/html;
+    index index.html index.php;
+
+    charset utf-8;
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+    }
+
+    location = /favicon.ico { access_log off; log_not_found off; }
+    location = /robots.txt  { access_log off; log_not_found off; }
+
+    access_log on;
+    error_log  /var/log/nginx/error.log error;
+
+    sendfile off;
+
+    client_max_body_size 100m;
+
+    location ~ \.php$ {
+        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_intercept_errors off;
+        fastcgi_buffer_size 16k;
+        fastcgi_buffers 4 16k;
+    }
+
+    location ~ /\.ht {
+        deny all;
+    }
+}

+ 28 - 0
Docker/php/Dockerfile

@@ -0,0 +1,28 @@
+FROM php:7.3-fpm
+
+RUN apt-get update && apt-get install -y \
+		libfreetype6-dev \
+		libjpeg62-turbo-dev \
+    libmcrypt-dev \
+		libpng-dev \
+		mysql-client \
+    zip \
+    libzip-dev && \
+		# docker-php-ext-install -j$(nproc) iconv && \
+		docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
+		apt-get install -y imagemagick libmagickwand-dev && \
+    pecl install imagick && docker-php-ext-enable imagick && \
+		docker-php-ext-install -j$(nproc) gd && \
+		docker-php-ext-install pdo_mysql zip && \
+		docker-php-ext-install opcache && \
+		docker-php-ext-install bcmath && \
+		apt-get install -y git vim && \
+		pecl install redis-4.3.0 && \
+    pecl install xdebug-2.7.0 && \
+    docker-php-ext-enable redis xdebug
+
+RUN export COMPOSER_HOME=/usr/local/composer && \
+	    curl -sS https://getcomposer.org/installer \
+				| php -- --install-dir=/usr/local/bin --filename=composer
+
+COPY ./php-custom.ini /usr/local/etc/php/conf.d/php-custom.ini

+ 2 - 0
Docker/php/php-custom.ini

@@ -0,0 +1,2 @@
+memory_limit = 526M
+date.timezone = Europe/Paris

+ 58 - 0
README.md

@@ -0,0 +1,58 @@
+# R2C
+
+r2C powered by grav  in docker environement (nginx, php:5.6-fpm)
+
+## Install docker
+```
+sudo pacman -S docker docker-compose docker-machine
+```
+
+## Clone this repos
+
+this will clone this repos (main docker environement) and the grav source code
+
+```
+git clone --recursive -o figli https://figureslibres.io/gogs/kevin/docker-r2c-grav.git
+```
+
+## Hosts and reverse proxy
+
+add to your /etc/hosts :
+```
+127.0.0.1	dev.r2c.net
+```
+configure your apache vhosts to add a reverse proxy that will redirect the dev.materio.com to our container
+```
+<Virtualhost *:80>
+   ServerName dev.r2c.net
+   ProxyPass / http://127.0.0.1:8880/
+   ProxyPassReverse / http://127.0.0.1:8880/
+   ProxyRequests Off
+</Virtualhost>
+```
+
+## Docker
+
+### start daemon
+launch the docker daemon
+```
+sudo systemctl start docker
+```
+### build
+only before the first run (may take some time)
+```
+sudo docker-compose build
+```
+### run
+then each time you want to launch the app
+```
+sudo docker-compose up -d
+```
+### loging in
+```
+sudo docker exec -it r2c-grav_php_1 bash
+```
+
+## Visualize
+You can now visit http://dev.2018.unesaisongraphique.fr or simply http://localhost:8880 on your browser
+After the first run

+ 30 - 0
docker-compose.yml

@@ -0,0 +1,30 @@
+version: "3.5"
+
+services:
+  php:
+    build: ./Docker/php/
+    expose:
+      - 9000
+    volumes:
+      - php-root-data:/root
+      - "${PROJECT_ROOT}:/var/www/html"
+    networks:
+      - server
+
+  nginx:
+    build: ./Docker/nginx/
+    ports:
+      - 8880:80
+    volumes:
+      - "${PROJECT_ROOT}:/var/www/html"
+      - "${LOG_ROOT}:/var/log:rw"
+    networks:
+      - server
+    depends_on:
+      - php
+
+volumes:
+    php-root-data:
+
+networks:
+    server:

+ 1 - 0
src

@@ -0,0 +1 @@
+Subproject commit 8a48a6ac0f86f798d2018591b01afb14e3450ed2