1
0
Fork 0

Merge pull request #1145 from Shleeble/patch-1

[WIP] Docker support with pgsql/sqlite3 and fixed en_US locales.
This commit is contained in:
daniel 2019-04-21 22:22:51 -06:00 committed by GitHub
commit dac54b1a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 41 deletions

View File

@ -6,6 +6,9 @@ APP_URL=http://localhost
ADMIN_DOMAIN="localhost"
APP_DOMAIN="localhost"
SESSION_DOMAIN="localhost"
SESSION_SECURE_COOKIE=true
TRUST_PROXIES="*"
LOG_CHANNEL=stack
@ -35,8 +38,6 @@ MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="pixelfed@example.com"
MAIL_FROM_NAME="Pixelfed"
SESSION_DOMAIN="${APP_DOMAIN}"
SESSION_SECURE_COOKIE=true
API_BASE="/api/1/"
API_SEARCH="/api/search"
@ -54,19 +55,20 @@ MIX_APP_URL="${APP_URL}"
MIX_API_BASE="${API_BASE}"
MIX_API_SEARCH="${API_SEARCH}"
ACTIVITY_PUB=false
REMOTE_FOLLOW=false
ACTIVITYPUB_INBOX=false
ACTIVITYPUB_SHAREDINBOX=false
HORIZON_DARKMODE=true
# Set these both "true" to enable federation.
# Set these "true" to enable federation.
# You might need to also run:
# php artisan cache:clear
# php artisan optimize:clear
# php artisan optimize
ACTIVITY_PUB=false
REMOTE_FOLLOW=false
PF_COSTAR_ENABLED=false
CS_BLOCKED_DOMAINS='example.org,example.net,example.com'
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

View File

@ -1,22 +1,24 @@
FROM php:7.2-apache
ARG COMPOSER_VERSION="1.6.5"
ARG COMPOSER_CHECKSUM="67bebe9df9866a795078bb2cf21798d8b0214f2e0b2fd81f2e907a8ef0be3434"
ARG COMPOSER_VERSION="1.8.5"
ARG COMPOSER_CHECKSUM="4e4c1cd74b54a26618699f3190e6f5fc63bb308b13fa660f71f2a2df047c0e17"
RUN apt-get update \
&& apt-get install -y --no-install-recommends git gosu \
optipng pngquant jpegoptim gifsicle \
optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-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 \
&& locale-gen && update-locale \
&& docker-php-source extract \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/lib/x86_64-linux-gnu/ \
--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 pcntl gd exif bcmath intl \
&& docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite pcntl gd exif bcmath intl zip \
&& pecl install imagick \
&& docker-php-ext-enable imagick pcntl imagick gd exif \
&& docker-php-ext-enable imagick pcntl imagick gd exif zip \
&& a2enmod rewrite remoteip \
&& {\
echo RemoteIPHeader X-Real-IP ;\
@ -44,7 +46,7 @@ RUN cp -r storage storage.skel \
&& composer install --prefer-source --no-interaction \
&& rm -rf html && ln -s public html
VOLUME ["/var/www/storage"]
VOLUME /var/www/storage /var/www/bootstrap
ENV APP_ENV=production \
APP_DEBUG=false \

View File

@ -1,22 +1,24 @@
FROM php:7.2-fpm
ARG COMPOSER_VERSION="1.6.5"
ARG COMPOSER_CHECKSUM="67bebe9df9866a795078bb2cf21798d8b0214f2e0b2fd81f2e907a8ef0be3434"
ARG COMPOSER_VERSION="1.8.5"
ARG COMPOSER_CHECKSUM="4e4c1cd74b54a26618699f3190e6f5fc63bb308b13fa660f71f2a2df047c0e17"
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
optipng pngquant jpegoptim gifsicle \
&& apt-get install -y --no-install-recommends git gosu \
optipng pngquant jpegoptim gifsicle libpq-dev libsqlite3-dev locales zip unzip libzip-dev \
libfreetype6 libjpeg62-turbo libpng16-16 libxpm4 libvpx4 libmagickwand-6.q16-3 \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev libvpx-dev libmagickwand-dev \
&& sed -i '/en_US/s/^#//g' /etc/locale.gen \
&& locale-gen && update-locale \
&& docker-php-source extract \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/lib/x86_64-linux-gnu/ \
--with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ \
--with-xpm-dir=/usr/lib/x86_64-linux-gnu/ \
--with-vpx-dir=/usr/lib/x86_64-linux-gnu/ \
&& docker-php-ext-install pdo_mysql pcntl gd exif bcmath \
&& docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite pcntl gd exif bcmath intl zip \
&& pecl install imagick \
&& docker-php-ext-enable imagick pcntl imagick gd exif \
&& docker-php-ext-enable imagick pcntl imagick gd exif zip \
&& curl -LsS https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar -o /usr/bin/composer \
&& echo "${COMPOSER_CHECKSUM} /usr/bin/composer" | sha256sum -c - \
&& chmod 755 /usr/bin/composer \
@ -35,7 +37,7 @@ RUN cp -r storage storage.skel \
&& composer install --prefer-dist --no-interaction \
&& rm -rf html && ln -s public html
VOLUME ["/var/www/storage", "/var/www/public.ext"]
VOLUME /var/www/storage /var/www/bootstrap
ENV APP_ENV=production \
APP_DEBUG=false \

View File

@ -2,19 +2,14 @@
# Create the storage tree if needed and fix permissions
cp -r storage.skel/* storage/
chown -R www-data:www-data storage/ bootstrap/cache/
chown -R www-data:www-data storage/ bootstrap/
php artisan storage:link
# Migrate database if the app was upgraded
gosu www-data:www-data php artisan migrate --force
# gosu www-data:www-data php artisan migrate --force
# 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
# gosu www-data:www-data php artisan update
# Finally run Apache
exec apache2-foreground

View File

@ -13,8 +13,8 @@ version: '3'
services:
app:
# Uncomment to build a local copy of the image
# build: .
# Comment to use dockerhub image
build: .
image: pixelfed
# If you have a traefik running, uncomment this to expose Pixelfed
# labels:
@ -25,20 +25,23 @@ services:
- ./.env
volumes:
- "app-storage:/var/www/storage"
- "app-bootstrap:/var/www/bootstrap"
networks:
- external
- internal
# Uncomment if you set HORIZON_EMBED to false and wish to run a local worker
# worker:
# image: pixelfed
# env_file:
# - ./.env
# volumes:
# - "app-storage:/var/www/storage"
# networks:
# - internal
# command: gosu www-data php artisan horizon
worker:
# Comment to use dockerhub image
build: .
image: pixelfed
env_file:
- ./.env
volumes:
- "app-storage:/var/www/storage"
- "app-bootstrap:/var/www/bootstrap"
networks:
- internal
command: gosu www-data php artisan horizon
db:
image: mysql:5.7
@ -53,7 +56,7 @@ services:
- "db-data:/var/lib/mysql"
redis:
image: redis:4-alpine
image: redis:5-alpine
volumes:
- "redis-data:/data"
networks:
@ -64,6 +67,7 @@ volumes:
redis-data:
db-data:
app-storage:
app-bootstrap:
networks:
internal: