mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
full docker setup
This commit is contained in:
parent
67c84a6933
commit
de5868f5ad
6 changed files with 40 additions and 17 deletions
|
@ -11,6 +11,7 @@ services:
|
|||
environment:
|
||||
- MIX_ENV=dev
|
||||
working_dir: /srv/philomena
|
||||
tty: true
|
||||
volumes:
|
||||
- .:/srv/philomena
|
||||
depends_on:
|
||||
|
@ -38,7 +39,7 @@ services:
|
|||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/app/Dockerfile
|
||||
dockerfile: ./docker/web/Dockerfile
|
||||
volumes:
|
||||
- .:/srv/philomena
|
||||
depends_on:
|
||||
|
|
|
@ -3,21 +3,18 @@ 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; \
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list; \
|
||||
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -; \
|
||||
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; \
|
||||
apt-get -qq -y install inotify-tools postgresql-client 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
|
||||
mix local.rebar --force
|
||||
|
||||
COPY docker/app/run-development /usr/local/bin/run-development
|
||||
COPY docker/app/safe-rsvg-convert /usr/local/bin/safe-rsvg-convert
|
||||
CMD run-development
|
24
docker/app/run-development
Executable file
24
docker/app/run-development
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Always install assets
|
||||
(cd /srv/philomena/assets && npm install)
|
||||
|
||||
# Always install mix dependencies
|
||||
(cd /srv/philomena && mix deps.get)
|
||||
|
||||
# Sleep to allow Elasticsearch to finish initializing
|
||||
# if it's not done doing whatever it does yet
|
||||
echo -n "Waiting for Elasticsearch"
|
||||
|
||||
until wget -qO - localhost:9200; do
|
||||
echo -n "."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
# Try to create the database if it doesn't exist yet
|
||||
createdb -h localhost -U postgres philomena_dev && mix ecto.setup_dev
|
||||
|
||||
# Run the application
|
||||
mix phx.server
|
2
docker/app/safe-rsvg-convert
Executable file
2
docker/app/safe-rsvg-convert
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
rsvg-convert < "$1" -o "$2"
|
|
@ -1,7 +1,6 @@
|
|||
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
|
||||
RUN envsubst '$APP_DIR' < /tmp/docker.nginx > /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -33,9 +33,9 @@ defmodule Philomena.Servers.ImageProcessor do
|
|||
|
||||
defp process(image_id) do
|
||||
Philomena.Processors.process_image(image_id)
|
||||
#rescue
|
||||
# _ ->
|
||||
# nil
|
||||
rescue
|
||||
_ ->
|
||||
nil
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
|
Loading…
Reference in a new issue