mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46:44 +01:00
docker compose files
This commit is contained in:
parent
1e4a157def
commit
72158617a5
4 changed files with 149 additions and 0 deletions
43
docker-compose.yml
Normal file
43
docker-compose.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
version: '3'
|
||||||
|
volumes:
|
||||||
|
postgres_data: {}
|
||||||
|
elastic_data: {}
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./docker/app/Dockerfile
|
||||||
|
environment:
|
||||||
|
- MIX_ENV=dev
|
||||||
|
working_dir: /srv/philomena
|
||||||
|
volumes:
|
||||||
|
- .:/srv/philomena
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- elasticsearch
|
||||||
|
- redis
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:12.1
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
elasticsearch:
|
||||||
|
image: elasticsearch:6.8.5
|
||||||
|
volumes:
|
||||||
|
- elastic_data:/var/lib/elasticsearch
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:5.0.7
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./docker/app/Dockerfile
|
||||||
|
volumes:
|
||||||
|
- .:/srv/philomena
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
ports:
|
||||||
|
- '80:8080'
|
23
docker/app/Dockerfile
Normal file
23
docker/app/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM elixir:1.9.4
|
||||||
|
|
||||||
|
RUN apt-get update; \
|
||||||
|
apt-get -qq -y install apt-transport-https; \
|
||||||
|
echo "deb https://deb.nodesource.com/node_12.x stretch main" >> /etc/apt/sources.list; \
|
||||||
|
wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -; \
|
||||||
|
apt-get update; \
|
||||||
|
apt-get -qq -y install build-essential git ffmpeg nodejs libmagic-dev libpng-dev gifsicle optipng libjpeg-progs librsvg2-bin; \
|
||||||
|
cd /tmp; \
|
||||||
|
git clone https://github.com/derpibooru/cli_intensities; \
|
||||||
|
cd cli_intensities; \
|
||||||
|
make install; \
|
||||||
|
echo -e '#!/bin/sh\nrsvg-convert < "$1" -o "$2"\n' > /usr/local/bin/safe-rsvg-convert; \
|
||||||
|
chmod +x /usr/local/bin/safe-rsvg-convert
|
||||||
|
|
||||||
|
WORKDIR /srv/philomena
|
||||||
|
ADD . /srv/philomena
|
||||||
|
|
||||||
|
RUN cd /srv/philomena; \
|
||||||
|
mix local.hex --force; \
|
||||||
|
mix deps.get; \
|
||||||
|
cd assets; \
|
||||||
|
npm install
|
7
docker/web/Dockerfile
Normal file
7
docker/web/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FROM nginx:1.17.6
|
||||||
|
ENV APP_DIR /srv/philomena
|
||||||
|
WORKDIR $APP_DIR
|
||||||
|
COPY docker/web/nginx.conf /tmp/docker.nginx
|
||||||
|
RUN envsubst '$APP_DIR' < /tmp/docker.nginx /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
76
docker/web/nginx.conf
Normal file
76
docker/web/nginx.conf
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
upstream philomena {
|
||||||
|
server localhost:4000 fail_timeout=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
root $APP_DIR/priv/static;
|
||||||
|
|
||||||
|
location ~ ^/img/view/(.+)/([0-9]+).*\.([A-Za-z]+)$ {
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias "$APP_DIR/priv/static/system/images/thumbs/$1/$2/full.$3";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/img/download/(.+)/([0-9]+).*\.([A-Za-z]+)$ {
|
||||||
|
add_header Content-Disposition "attachment";
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias "$APP_DIR/priv/static/system/images/thumbs/$1/$2/full.$3";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/img/(.+) {
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias $APP_DIR/priv/static/system/images/thumbs/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/spns/(.+) {
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias $APP_DIR/priv/static/system/images/adverts/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/avatars/(.+) {
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias $APP_DIR/priv/static/system/images/avatars/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/media/(.+) {
|
||||||
|
expires max;
|
||||||
|
add_header Cache-Control public;
|
||||||
|
alias $APP_DIR/priv/static/system/images/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri @proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @proxy {
|
||||||
|
proxy_pass http://philomena;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_set_header Host $host:$server_port;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
|
client_max_body_size 30m;
|
||||||
|
client_body_buffer_size 128k;
|
||||||
|
|
||||||
|
proxy_connect_timeout 90;
|
||||||
|
proxy_send_timeout 90;
|
||||||
|
proxy_read_timeout 90;
|
||||||
|
|
||||||
|
proxy_buffer_size 4k;
|
||||||
|
proxy_buffers 4 32k;
|
||||||
|
proxy_busy_buffers_size 64k;
|
||||||
|
proxy_temp_file_write_size 64k;
|
||||||
|
|
||||||
|
# Configuration for Phoenix WS
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue