Create OTP_VERSION file by `mix release`
authorkPherox <admin@mail.kr-kp.com>
Thu, 9 Apr 2020 15:19:09 +0000 (00:19 +0900)
committerkPherox <admin@mail.kr-kp.com>
Thu, 9 Apr 2020 15:22:50 +0000 (00:22 +0900)
Dockerfile
mix.exs

index c2f3ad98c9a3478a360ff836c2ab219ab4eadc73..29931a5e3a398cd2fef9cb0e244da7db5725ce1f 100644 (file)
@@ -12,8 +12,6 @@ RUN apk add git gcc g++ musl-dev make &&\
        mkdir release &&\
        mix release --path release
 
-RUN echo "${OTP_VERSION}" > release/OTP_VERSION
-
 FROM alpine:3.11
 
 ARG BUILD_DATE
diff --git a/mix.exs b/mix.exs
index 3e4c7cbd82bcd04956c9f376a8a854e1d7cce462..ad202951858d4721c5b6cfabcdf2e0a9286a0acd 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -37,12 +37,21 @@ defmodule Pleroma.Mixfile do
         pleroma: [
           include_executables_for: [:unix],
           applications: [ex_syslogger: :load, syslog: :load],
-          steps: [:assemble, &copy_files/1, &copy_nginx_config/1]
+          steps: [:assemble, &put_files/1, &copy_files/1, &copy_nginx_config/1]
         ]
       ]
     ]
   end
 
+  def put_files(%{path: target_path} = release) do
+    File.write!(
+      Path.join([target_path, "OTP_VERSION"]),
+      Pleroma.OTPVersion.version()
+    )
+
+    release
+  end
+
   def copy_files(%{path: target_path} = release) do
     File.cp_r!("./rel/files", target_path)
     release