Page MenuHomeDevCentral

D375.id896.diff
No OneTemporary

D375.id896.diff

diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,4 @@
+{
+ "repository.callsign": "DGROVE",
+ "phabricator.uri": "https://devcentral.nasqueron.org"
+}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,25 @@
+#
+# Nasqueron - Auth Grove image
+#
+
+FROM nasqueron/nginx-php-fpm:novolume
+MAINTAINER Nasqueron Organisation <docker@nasqueron.org>
+
+#
+# Prepare the container
+#
+
+COPY files /
+
+WORKDIR /var/wwwroot/default
+
+RUN git init && git remote add origin https://github.com/nasqueron/auth-grove.git && \
+ git fetch && git checkout -t origin/master && \
+ composer install --no-dev -o && \
+ chown -R app:app /var/wwwroot/default
+
+#
+# Run the container
+#
+
+CMD ["/usr/local/sbin/init-container"]
diff --git a/files/etc/nginx/sites-available/default b/files/etc/nginx/sites-available/default
new file mode 100644
--- /dev/null
+++ b/files/etc/nginx/sites-available/default
@@ -0,0 +1,22 @@
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+ server_name _;
+
+ root /var/wwwroot/default/public;
+
+ index index.php index.html index.htm;
+
+ location / {
+ try_files $uri /index.php$is_args$args;
+ }
+
+ location ~ \.php$ {
+ include snippets/fastcgi-php.conf;
+ fastcgi_pass 127.0.0.1:9000;
+ }
+
+ location ~ /\.ht {
+ deny all;
+ }
+}
diff --git a/files/usr/local/bin/setup-container b/files/usr/local/bin/setup-container
new file mode 100755
--- /dev/null
+++ b/files/usr/local/bin/setup-container
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+pushd /var/wwwroot/default
+
+# Generates a unique application key in .env
+function generate_key {
+ KEY=`php artisan key:generate --show`
+ if [ -f .env ]; then
+ echo "" >> .env
+ fi
+ echo "APP_KEY=$KEY" >> .env
+}
+
+# Determines if APP_KEY is missing
+function is_app_key_missing {
+ if [ -v APP_KEY ]; then
+ return 0
+ fi
+
+ if [ ! -f .env ]; then
+ return 1
+ fi
+
+ grep -q 'APP_KEY=' .env
+ return $?
+}
+
+if [ -z "$NO_INSTALL" ]; then
+ is_app_key_missing
+ if [ $? -eq 1 ]; then
+ generate_key
+ fi
+ php artisan config:cache
+ chown app:app /var/wwwroot/default
+fi
+
+# We're done
+popd
+touch .initialized
diff --git a/files/usr/local/sbin/init-container b/files/usr/local/sbin/init-container
new file mode 100755
--- /dev/null
+++ b/files/usr/local/sbin/init-container
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f .initialized ]; then
+ # Container is initialized according the environment variables
+ # passed to the container to setup the application.
+ /usr/local/bin/setup-container
+fi
+
+/usr/local/sbin/runsvdir-init

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 10:32 (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249205
Default Alt Text
D375.id896.diff (2 KB)

Event Timeline