1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 00:05:29 +00:00

Add simple docker deployment

This commit is contained in:
kpcyrd 2018-05-20 15:02:29 +02:00
parent 0f55fbacc4
commit 77ca794cf0
5 changed files with 86 additions and 0 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
storage
data
Dockerfile
.dockerignore
.git
.gitignore
.env

1
.gitignore vendored
View file

@ -6,6 +6,7 @@
/.idea /.idea
/.vscode /.vscode
/.vagrant /.vagrant
/docker-volumes
Homestead.json Homestead.json
Homestead.yaml Homestead.yaml
npm-debug.log npm-debug.log

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM php:7.2-fpm-alpine
RUN apk add --no-cache git imagemagick \
&& apk add --no-cache --virtual .build build-base autoconf imagemagick-dev libtool \
&& docker-php-ext-install pdo_mysql \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& apk del --purge .build
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
WORKDIR /var/www/html
COPY . .
RUN composer install --prefer-source --no-interaction
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"

22
contrib/nginx.conf Normal file
View file

@ -0,0 +1,22 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
index index.php index.html;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

39
docker-compose.yml Normal file
View file

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