Page MenuHomeDevCentral

D2023.id5104.diff
No OneTemporary

D2023.id5104.diff

diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,4 @@
+{
+ "repository.callsign": "DPIXEL",
+ "phabricator.uri": "https://devcentral.nasqueron.org"
+}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,28 @@
+#
+# Nasqueron - Pixelfed image
+#
+
+FROM nasqueron/nginx-php7-fpm:novolume
+MAINTAINER Sébastien Santoro aka Dereckson <dereckson+nasqueron-docker@espace-win.org>
+
+#
+# Prepare the container
+#
+
+COPY files /
+
+WORKDIR /var/wwwroot/default
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ optipng pngquant jpegoptim gifsicle && \
+ apt-get clean && rm -rf /var/lib/apt/lists/* && \
+ git init && git remote add origin https://github.com/pixelfed/pixelfed.git && \
+ git fetch && git checkout -t origin/dev && \
+ 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,40 @@
+#!/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
+ php artisan storage:link
+ php artisan migrate --force
+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, 08:54 (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249025
Default Alt Text
D2023.id5104.diff (2 KB)

Event Timeline