Replaced docker-compose.yml, run composer as root, create needed directories for application storage, revert changes to nginx.conf

This commit is contained in:
Moritz Heiber 2018-05-31 21:43:14 +02:00
parent 5117f003fe
commit 1fec673728
No known key found for this signature in database
GPG key ID: 650DA6EE5526CD96
4 changed files with 52 additions and 94 deletions

View file

@ -12,23 +12,20 @@ RUN apk add --no-cache --virtual .build build-base autoconf imagemagick-dev libt
echo "${COMPOSER_CHECKSUM} /tmp/composer.phar" | sha256sum -c - && \ echo "${COMPOSER_CHECKSUM} /tmp/composer.phar" | sha256sum -c - && \
install -m0755 -o root -g root /tmp/composer.phar /usr/bin/composer.phar && \ install -m0755 -o root -g root /tmp/composer.phar /usr/bin/composer.phar && \
ln -sf /usr/bin/composer.phar /usr/bin/composer && \ ln -sf /usr/bin/composer.phar /usr/bin/composer && \
mkdir -p /var/www && \
install -d -m0755 -o www-data -g www-data /var/www/html/pixelfed \
/var/www/html/pixelfed/storage \
/var/www/html/pixelfed/storage/framework \
/var/www/html/pixelfed/storage/logs \
/var/www/html/pixelfed/storage/framework/sessions \
/var/www/html/pixelfed/storage/framework/views \
/var/www/html/pixelfed/storage/framework/cache && \
rm /tmp/composer.phar && \ rm /tmp/composer.phar && \
apk del --purge .build apk --no-cache del --purge .build
COPY --chown=www-data . /var/www/html/pixelfed/ COPY . /var/www/html/
WORKDIR /var/www/html/pixelfed WORKDIR /var/www/html
USER www-data RUN install -d -m0755 -o www-data -g www-data \
RUN composer install --prefer-source --no-interaction /var/www/html/storage \
/var/www/html/storage/framework \
/var/www/html/storage/logs \
/var/www/html/storage/framework/sessions \
/var/www/html/storage/framework/views \
/var/www/html/storage/framework/cache && \
composer install --prefer-source --no-interaction
VOLUME ["/var/www/html"] VOLUME ["/var/www/html"]
USER root
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}" ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"

View file

@ -4,7 +4,7 @@ server {
server_name localhost; server_name localhost;
index index.php index.html; index index.php index.html;
root /var/www/html/pixelfed/public; root /var/www/html/public;
location / { location / {
try_files $uri $uri/ /index.php; try_files $uri $uri/ /index.php;

View file

@ -1,64 +0,0 @@
---
version: '3'
services:
nginx:
image: nginx:alpine
networks:
- internal
- external
ports:
- 3000:80
volumes:
- "php-storage:/var/www/html"
- ./contrib/nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
php:
build: .
image: pixelfed
volumes:
- "php-storage:/var/www/html"
networks:
- internal
environment:
- DB_HOST=mysql
- DB_DATABASE=pixelfed
- DB_USERNAME=${DB_USERNAME:-pixelfed}
- DB_PASSWORD=${DB_PASSWORD:-pixelfed}
- REDIS_HOST=redis
- APP_KEY=${APP_KEY}
env_file:
- ./.env
mysql:
image: mysql:5.7
networks:
- internal
environment:
- MYSQL_DATABASE=pixelfed
- MYSQL_USER=${DB_USERNAME:-pixelfed}
- MYSQL_PASSWORD=${DB_PASSWORD:-pixelfed}
- MYSQL_RANDOM_ROOT_PASSWORD="true"
env_file:
- ./.env
volumes:
- "mysql-data:/var/lib/mysql"
redis:
image: redis:alpine
volumes:
- "redis-data:/data"
networks:
- internal
volumes:
redis-data:
mysql-data:
php-storage:
networks:
internal:
internal: true
external:
driver: bridge

View file

@ -3,37 +3,62 @@ version: '3'
services: services:
nginx: nginx:
image: nginx:alpine image: nginx:alpine
networks:
- internal
- external
ports: ports:
- 3000:80 - 3000:80
volumes: volumes:
- .:/var/www/html - "php-storage:/var/www/html"
- ./contrib/nginx.conf:/etc/nginx/conf.d/default.conf - ./contrib/nginx.conf:/etc/nginx/conf.d/default.conf
depends_on: depends_on:
- php - php
php: php:
build: . build: .
image: pixelfed
volumes: volumes:
- ./storage:/var/www/html/storage - "php-storage:/var/www/html"
depends_on: networks:
- mysql - internal
- redis
environment: environment:
- DB_HOST=mysql - DB_HOST=mysql
- DB_DATABASE=pixelfed - DB_DATABASE=pixelfed
- DB_USERNAME=${DB_USERNAME} - DB_USERNAME=${DB_USERNAME:-pixelfed}
- DB_PASSWORD=${DB_PASSWORD} - DB_PASSWORD=${DB_PASSWORD:-pixelfed}
- REDIS_HOST=redis - REDIS_HOST=redis
- APP_KEY=${APP_KEY} - APP_KEY=${APP_KEY}
env_file:
- ./.env
mysql: mysql:
image: mysql:5.7 image: mysql:5.7
networks:
- internal
environment: environment:
- MYSQL_DATABASE=pixelfed - MYSQL_DATABASE=pixelfed
- MYSQL_USER=${DB_USERNAME} - MYSQL_USER=${DB_USERNAME:-pixelfed}
- MYSQL_PASSWORD=${DB_PASSWORD} - MYSQL_PASSWORD=${DB_PASSWORD:-pixelfed}
- MYSQL_RANDOM_ROOT_PASSWORD="true"
env_file:
- ./.env
volumes: volumes:
- ./docker-volumes/mysql:/var/lib/mysql - "mysql-data:/var/lib/mysql"
redis: redis:
image: redis:alpine image: redis:alpine
volumes: volumes:
- ./docker-volumes/redis:/data - "redis-data:/data"
... networks:
- internal
volumes:
redis-data:
mysql-data:
php-storage:
networks:
internal:
internal: true
external:
driver: bridge