From 320c17a29d06a7772cf2344a4597f69368cbcea1 Mon Sep 17 00:00:00 2001
From: prichier <pascoualito@gmail.com>
Date: Sat, 31 Oct 2020 02:39:32 +0100
Subject: [PATCH] Fix overlay & enoent error on image uploads

---
 docker/production/Dockerfile   |  3 ++-
 docker/production/README.md    | 20 ++++++++++----------
 docker/production/releases.exs |  5 +++++
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile
index 81408ef81..d4c54e2f3 100644
--- a/docker/production/Dockerfile
+++ b/docker/production/Dockerfile
@@ -21,6 +21,7 @@ RUN mix local.hex --force \
 COPY lib ./lib
 COPY priv ./priv
 COPY config ./config
+COPY rel ./rel
 COPY docker/production/releases.exs ./config/
 COPY --from=assets ./priv/static ./priv/static
 
@@ -30,7 +31,7 @@ RUN mix phx.digest \
 # Finally setup the app
 FROM alpine
 
-RUN apk add --no-cache openssl ncurses-libs
+RUN apk add --no-cache openssl ncurses-libs file
 
 USER nobody
 EXPOSE 4000
diff --git a/docker/production/README.md b/docker/production/README.md
index 7054146de..2864f43a1 100644
--- a/docker/production/README.md
+++ b/docker/production/README.md
@@ -35,22 +35,22 @@ Instanciate required Postgres extensions:
     # CREATE EXTENSION pg_trgm;
     # CREATE EXTENSION unaccent;
 
-
-Then run migrations:
-
-    docker-compose run --rm mobilizon eval Mobilizon.CLI.migrate
-
 Finally, run the application:
 
     docker-compose up -d mobilizon
 
+A migration will be automatically run before starting Mobilizon (can be run even if no migration is needed without incidence).
+
+## Run a mobilizon_ctl command
+
+    docker-compose exec mobilizon mobilizon_ctl [options]
+
 ## Update the service
 
-Pull the latest image, then run the migrations:
+Pull the latest image, then update the service:
 
     docker-compose pull mobilizon
-    docker-compose run --rm mobilizon eval Mobilizon.CLI.migrate
-
-Finally, update the service:
-
     docker-compose up -d mobilizon
+
+Migration is automatic.
+
diff --git a/docker/production/releases.exs b/docker/production/releases.exs
index 72d84ca4e..d3284e0f9 100644
--- a/docker/production/releases.exs
+++ b/docker/production/releases.exs
@@ -22,6 +22,11 @@ config :mobilizon, :instance,
   email_from: System.get_env("MOBILIZON_INSTANCE_EMAIL", "noreply@mobilizon.lan"),
   email_reply_to: System.get_env("MOBILIZON_REPLY_EMAIL", "noreply@mobilizon.lan")
 
+
+config :mobilizon, Mobilizon.Web.Upload.Uploader.Local,
+  uploads: System.get_env("MOBILIZON_UPLOADS", "/app/uploads")
+
+
 config :mobilizon, Mobilizon.Storage.Repo,
   adapter: Ecto.Adapters.Postgres,
   username: System.get_env("MOBILIZON_DATABASE_USERNAME", "username"),