Coastas 2 anni fa
commit
acbd2525a0
5 ha cambiato i file con 125 aggiunte e 0 eliminazioni
  1. 9 0
      .gitignore
  2. 22 0
      README.md
  3. 28 0
      default.conf
  4. 64 0
      docker-compose.yml
  5. 2 0
      php/Dockerfile

+ 9 - 0
.gitignore

@@ -0,0 +1,9 @@
+src/
+mysql/
+
+# macOS
+.DS_Store
+
+# IntelliJ
+.idea
+*.iml

+ 22 - 0
README.md

@@ -0,0 +1,22 @@
+# Empire Docker
+Docker Compose setup for local development of `empire`.
+
+## Pre-reqs
+* Docker
+* Docker Compose
+
+## Usage
+1. `git clone http://git.swc-empire.com/Coastas/empire-docker.git`
+2. `mkdir src && cd src`
+3. `git clone http://git.swc-empire.com/empire/empire.git`
+4. `cd ..`
+5. `docker compose up -d`
+
+### DB Migrations
+1. `docker exec -it empire-php-1 bash`
+2. `cd application`
+3. `./bin/phinx migrate`
+
+### Access
+* localhost:80 -> app
+* localhost:81 -> phpMyAdmin

+ 28 - 0
default.conf

@@ -0,0 +1,28 @@
+server {
+    listen 80 default_server;
+    root /var/www/html;
+    index index.html index.php;
+
+    charset utf-8;
+
+    location = /favicon.ico { access_log off; log_not_found off; }
+    location = /robots.txt { access_log off; log_not_found off; }
+
+    access_log off;
+
+    sendfile off;
+
+    client_max_body_size 100m;
+
+    location / {
+        try_files $uri /index.php$is_args$args;
+    }
+
+    location ~ ^/index\.php(/|$) {
+        fastcgi_pass php:9000;
+        fastcgi_split_path_info ^(.+\.php)(/.*)$;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        fastcgi_param HTTPS off;
+    }
+}

+ 64 - 0
docker-compose.yml

@@ -0,0 +1,64 @@
+version: "3"
+
+services:
+  web:
+    image: nginx:latest
+    restart: always
+    ports:
+      - "80:80"
+    volumes:
+      - ./src:/var/www/html/
+      - ./default.conf:/etc/nginx/conf.d/default.conf
+    networks:
+      - empire
+    depends_on:
+      - php
+    links:
+      - php
+  php:
+    build: ./php
+    restart: always
+    expose:
+      - 9000
+    volumes:
+      - ./src:/var/www/html/
+    networks:
+      - empire
+    depends_on:
+      - mysql
+    links:
+      - mysql
+  mysql:
+    image: mysql:5.7
+    platform: linux/x86_64
+    command: --lower_case_table_names=1 --sql-mode=''
+    restart: always
+    volumes:
+      - "./mysql:/var/lib/mysql"
+      - "./src/application/db/migrations/setup.sql:/docker-entrypoint-initdb.d/setup.sql"
+    networks:
+      - empire
+    environment:
+      MYSQL_ROOT_HOST: "%"
+      MYSQL_DATABASE: "empire"
+      MYSQL_USER: "test"
+      MYSQL_PASSWORD: "test"
+      MYSQL_ROOT_PASSWORD: "test"
+      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
+  phpmyadmin:
+    image: phpmyadmin/phpmyadmin:latest
+    restart: always
+    environment:
+      PMA_HOST: mysql
+      PMA_USER: root
+      PMA_PASSWORD: test
+    ports:
+      - "81:80"
+    depends_on:
+      - mysql
+    links:
+      - mysql
+
+networks:
+  empire:
+    driver: bridge

+ 2 - 0
php/Dockerfile

@@ -0,0 +1,2 @@
+FROM php:7-fpm
+RUN docker-php-ext-install pdo pdo_mysql