From 967a153bebf7d19f7b92740d86c266c974a94c0b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 3 Oct 2017 01:31:25 +0200 Subject: [PATCH] create image for docker olympe api --- Olympe/api/Dockerfile | 17 +++++++++ Olympe/api/api.conf | 35 +++++++++++++++++++ .../api/rootfs/nginx/sites-enabled/api.conf | 32 +++++++++++++++++ Olympe/api/rootfs/usr/local/bin/startup | 16 +++++++++ 4 files changed, 100 insertions(+) create mode 100644 Olympe/api/Dockerfile create mode 100644 Olympe/api/api.conf create mode 100644 Olympe/api/rootfs/nginx/sites-enabled/api.conf create mode 100755 Olympe/api/rootfs/usr/local/bin/startup diff --git a/Olympe/api/Dockerfile b/Olympe/api/Dockerfile new file mode 100644 index 0000000..08d1fe6 --- /dev/null +++ b/Olympe/api/Dockerfile @@ -0,0 +1,17 @@ +FROM xataz/nginx-php + +ENV UID=991 \ + GID=991 + +RUN mkdir /sites-enabled \ + && apk add -U git \ + && git clone --recursive https://git.drycat.fr/Dryusdan/Olympe-phpAPI.git /api \ + && apk del git \ + && rm -rf /var/cache/apk/* /tmp/* /root/.gnupg /root/.cache/ /api/.git + +COPY rootfs / + +RUN chmod +x /usr/local/bin/startup + +ENTRYPOINT ["/usr/local/bin/startup"] +CMD ["/bin/s6-svscan", "/etc/s6.d"] diff --git a/Olympe/api/api.conf b/Olympe/api/api.conf new file mode 100644 index 0000000..963c838 --- /dev/null +++ b/Olympe/api/api.conf @@ -0,0 +1,35 @@ +server { + listen 8080; + server_name default; + index index.php index.html index.htm; + merge_slashes off; + large_client_header_buffers 4 32k; + root /shaarli/; + + location / { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location /[.*] { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location @handler { + rewrite ^ /index.php?/$request_uri; + } + + location ~ \.php$ { + fastcgi_index index.php; + fastcgi_pass unix:/php/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include /nginx/conf/fastcgi_params; + } +} + + diff --git a/Olympe/api/rootfs/nginx/sites-enabled/api.conf b/Olympe/api/rootfs/nginx/sites-enabled/api.conf new file mode 100644 index 0000000..ea7db83 --- /dev/null +++ b/Olympe/api/rootfs/nginx/sites-enabled/api.conf @@ -0,0 +1,32 @@ +server { + listen 8080; + index index.php index.html index.htm; + merge_slashes off; + large_client_header_buffers 4 32k; + root /api/; + + location / { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location /[.*] { + try_files $uri $uri/ @handler; + expires 30d; + root /shaarli/; + index index.html index.htm index.php; + } + + location @handler { + rewrite ^ /index.php?/$request_uri; + } + + location ~ \.php$ { + fastcgi_index index.php; + fastcgi_pass unix:/php/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include /nginx/conf/fastcgi_params; + } +} diff --git a/Olympe/api/rootfs/usr/local/bin/startup b/Olympe/api/rootfs/usr/local/bin/startup new file mode 100755 index 0000000..8c842ba --- /dev/null +++ b/Olympe/api/rootfs/usr/local/bin/startup @@ -0,0 +1,16 @@ +#!/bin/sh + +addgroup -g ${GID} web && adduser -H -s /bin/sh -D -G web -u ${UID} web + +mkdir -p /nginx /php + +chown -R web:web /nginx /php /etc/s6.d /api + +if [ '$@' == '' ]; then + echo "here" + exec su-exec web:web /bin/s6-svscan /etc/s6.d +else + echo "la" + exec su-exec web:web "$@" +fi +