Skip to content

Instantly share code, notes, and snippets.

@vitorpacheco
Created March 24, 2018 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitorpacheco/5c49a5ffd3795e5ca07fa30876b65755 to your computer and use it in GitHub Desktop.
Save vitorpacheco/5c49a5ffd3795e5ca07fa30876b65755 to your computer and use it in GitHub Desktop.
php-oracle
web:
image: nginx:latest
ports:
- 8080:80
volumes:
- ./app:/app
- ./nginx.conf:/etc/nginx/conf.d/default.conf
links:
- php
composer:
image: composer:latest
volumes:
- ./app:/app
command: install
php:
build: app
volumes:
- ./app:/app
# vim:set ft=dockerfile:
# Create image based on the official Node 9.6.1 image from dockerhub
FROM php:7.2.2-fpm
# Install dependecies
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libmemcached-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
libaio-dev \
unzip \
wget \
unixodbc-dev \
libxml2-dev
# Install Oracle Instantclient
RUN mkdir /opt/oracle \
&& cd /opt/oracle \
&& wget -nv https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.2.0.1.0.zip \
&& wget -nv https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.2.0.1.0.zip \
&& wget -nv https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip \
&& unzip /opt/oracle/instantclient-basic-linux.x64-12.2.0.1.0.zip -d /usr/local/ \
&& unzip /opt/oracle/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /usr/local/ \
&& unzip /opt/oracle/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip -d /usr/local/ \
&& ln -s /usr/local/instantclient_12_2 /usr/local/instantclient \
&& ln -s /usr/local/instantclient/libclntsh.so.12.1 /usr/local/instantclient/libclntsh.so \
&& ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus
ENV LD_LIBRARY_PATH=/usr/local/instantclient
# Install extensions
RUN docker-php-source extract \
&& echo 'instantclient,/usr/local/instantclient' | pecl install oci8 \
&& pecl install xdebug memcached-3.0.4 sqlsrv-4.3.0 pdo_sqlsrv-4.3.0 \
&& docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/local/instantclient \
&& docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr/local/instantclient \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-enable xdebug opcache memcached sqlsrv pdo_sqlsrv \
&& docker-php-ext-install intl iconv zip gd soap pdo pdo_pgsql pdo_mysql pdo_oci oci8 \
&& docker-php-source delete
EXPOSE 9000
CMD ["php-fpm"]
server {
listen 80 default_server;
server_name sgest.local;
index index.php index.html index.htm;
root /app;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
try_files $uri $uri/ /index.php$is_args$args;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-XSRF-TOKEN';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
}
location ~ \.php$ {
try_files $uri $uri/ /index.php?$query_string =404;
# try_files $uri $uri/ /index.html =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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment