浏览代码

Consolidated Docker config into repository

main
Simon Bowie 3 年前
父节点
当前提交
4a09e10f51
共有 6 个文件被更改,包括 115 次插入0 次删除
  1. +2
    -0
      .gitignore
  2. +15
    -0
      README.md
  3. +30
    -0
      docker-compose.yml
  4. +33
    -0
      nginx/default.conf
  5. +9
    -0
      php/Dockerfile
  6. +26
    -0
      public/index.php

+ 2
- 0
.gitignore 查看文件

@@ -1 +1,3 @@
.DS_Store

solrdata

+ 15
- 0
README.md 查看文件

@@ -0,0 +1,15 @@
Docker Compose and Docker files for deploying the development environment for the Politics of Patent case study site.

Deployed Solr for .rtf indexing using instructions at: https://github.com/docker-solr/docker-solr

Created core using:

`docker exec -it solr solr create_core -c epo_data`

Add files to Solr using:

`docker run --rm -v "/Users/ad7588/Downloads/2018 (10381):/2018" --network=host solr:latest post -c epo_data /2018`

Note this fix to ensure that .rtf files can be indexed using Apache Tika: https://gitmemory.com/issue/docker-solr/docker-solr/341/682877640

Note that on Mac the PHP container has to communicate with the Solr container using the hostname 'host.docker.internal' rather than 'localhost' or '127.0.0.1': https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

+ 30
- 0
docker-compose.yml 查看文件

@@ -0,0 +1,30 @@
version: '3.8'

services:
php:
container_name: php
build:
context: ./php
ports:
- '9000:9000'
volumes:
- ./public:/var/www/html

nginx:
container_name: nginx
image: nginx:latest
ports:
- '8080:80'
volumes:
- ./public:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php

solr:
container_name: solr
image: solr:latest
ports:
- '8983:8983'
volumes:
- ./solrdata:/var/solr

+ 33
- 0
nginx/default.conf 查看文件

@@ -0,0 +1,33 @@
server {

listen 80;
index index.php;
server_name localhost;
root /var/www/html;
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;

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 $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;

internal;
}

location ~ \\.php$ {
return 404;
}

}

+ 9
- 0
php/Dockerfile 查看文件

@@ -0,0 +1,9 @@
FROM php:8.0-fpm

#RUN apt update \
# && apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip \
# && docker-php-ext-install intl opcache pdo pdo_mysql \
# && pecl install apcu \
# && docker-php-ext-enable apcu \
# && docker-php-ext-configure zip \
# && docker-php-ext-install zip

+ 26
- 0
public/index.php 查看文件

@@ -24,6 +24,32 @@ $random = array_rand($json->response->docs);

?>

Application ID:

<?php

// Search for the title in the content element and display it
$content = $json->response->docs[$random]->content;
preg_match('/Application.*\n(.*)\n/', $content, $application_id);
print_r($application_id[1]);

?>

<br><br>

EPO publication:

<?php

// Search for the title in the content element and display it
$content = $json->response->docs[$random]->content;
preg_match('/Publication.*\n(.*)\n/', $content, $publication);
print_r($publication[1]);

?>

<br><br>

Title:

<?php

正在加载...
取消
保存