Browse Source

Merge pull request #1184 from Shleeble/patch-2

Docker patch 2
daniel 6 years ago
parent
commit
d92d9ddaf0
4 changed files with 24 additions and 8 deletions
  1. 2 1
      .env.example
  2. 5 5
      contrib/docker/Dockerfile.apache
  3. 11 0
      contrib/docker/start.sh
  4. 6 2
      docker-compose.yml

+ 2 - 1
.env.example

@@ -71,4 +71,5 @@ CS_CW_DOMAINS='example.org,example.net,example.com'
 CS_UNLISTED_DOMAINS='example.org,example.net,example.com'
 
 ## Optional 
-HORIZON_DARKMODE=true  # Horizon theme darkmode
+#HORIZON_DARKMODE=false  # Horizon theme darkmode
+#HORIZON_EMBED=false  # Single Docker Container mode 

+ 5 - 5
contrib/docker/Dockerfile.apache

@@ -1,11 +1,12 @@
-FROM php:7.2-apache
+FROM php:7.3-apache
 
 ARG COMPOSER_VERSION="1.8.5"
 ARG COMPOSER_CHECKSUM="4e4c1cd74b54a26618699f3190e6f5fc63bb308b13fa660f71f2a2df047c0e17"
 
 RUN apt-get update \
+ && apt-get install -y --no-install-recommends apt-utils \
  && apt-get install -y --no-install-recommends git gosu \
-      optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-dev \
+      optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-dev libcurl4-openssl-dev \
       libfreetype6 libicu-dev libjpeg62-turbo libpng16-16 libxpm4 libwebp6 libmagickwand-6.q16-3 \
       libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libwebp-dev libmagickwand-dev \
  && sed -i '/en_US/s/^#//g' /etc/locale.gen \
@@ -16,9 +17,9 @@ RUN apt-get update \
       --with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ \
       --with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \
       --with-webp-dir=/usr/lib/x86_64-linux-gnu/ \
- && docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite pcntl gd exif bcmath intl zip \
+ && docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite pcntl gd exif bcmath intl zip curl \
  && pecl install imagick \
- && docker-php-ext-enable imagick pcntl imagick gd exif zip \
+ && docker-php-ext-enable imagick pcntl imagick gd exif zip curl \
  && a2enmod rewrite remoteip \
  && {\
      echo RemoteIPHeader X-Real-IP ;\
@@ -56,7 +57,6 @@ ENV APP_ENV=production \
     DB_HOST=db \
     BROADCAST_DRIVER=log \
     QUEUE_DRIVER=redis \
-    HORIZON_EMBED=TRUE \
     HORIZON_PREFIX=horizon-pixelfed \
     REDIS_HOST=redis \
     SESSION_SECURE_COOKIE=true \

+ 11 - 0
contrib/docker/start.sh

@@ -3,7 +3,13 @@
 # Create the storage tree if needed and fix permissions
 cp -r storage.skel/* storage/
 chown -R www-data:www-data storage/ bootstrap/
+
+# Refresh the environment
 php artisan storage:link
+php artisan horizon:assets
+php artisan route:cache
+php artisan view:cache
+php artisan config:cache
 
 # Migrate database if the app was upgraded
 # gosu www-data:www-data php artisan migrate --force
@@ -11,5 +17,10 @@ php artisan storage:link
 # Run other specific migratins if required
 # gosu www-data:www-data php artisan update
 
+# Run a worker if it is set as embedded
+if [ "$HORIZON_EMBED" = "true" ]; then
+  gosu www-data:www-data php artisan horizon &
+fi
+
 # Finally run Apache
 exec apache2-foreground

+ 6 - 2
docker-compose.yml

@@ -16,11 +16,14 @@ services:
     # Comment to use dockerhub image
     build: .
     image: pixelfed
-    # If you have a traefik running, uncomment this to expose Pixelfed
+    ## If you have a traefik running, uncomment this to expose Pixelfed
     # labels:
     #   - traefik.enable=true
     #   - traefik.frontend.rule=Host:your.url
     #   - traefik.port=80
+    ## If you have a standard reverse proxy, uncommit this to expose Pixelfed
+    # ports:
+    #   - "127.0.0.1:8080:80"
     env_file:
       - ./.env
     volumes:
@@ -30,7 +33,7 @@ services:
       - external
       - internal
 
-  worker:
+  worker:  # Comment this whole block if HORIZON_EMBED is true.
     # Comment to use dockerhub image
     build: .
     image: pixelfed
@@ -40,6 +43,7 @@ services:
       - "app-storage:/var/www/storage"
       - "app-bootstrap:/var/www/bootstrap"
     networks:
+      - external  # Required for ActivityPub
       - internal
     command: gosu www-data php artisan horizon