kuroda

kuroda

Mix release - How can I copy extra files into tar ball?

I wrote the following mix.exs to release my Phoenix application as a tar ball, referring to the “Steps” section of the Mix.Tasks.Release documentation.

defmodule MyApp.MixProject do
  use Mix.Project

  def project do
    [
      apps_path: "apps",
      apps: [:shared, :admin, :shop],
      version: "0.1.0",
      start_permanent: Mix.env() in [:qa, :prod],
      deps: deps(),
      releases: [
        my_app: [
          applications: [
            admin: :permanent,
            shop: :permanent
          ],
          steps: [:assemble, &copy_extra_files/1, :tar]
        ]
      ],
      default_release: :my_app
    ]
  end

  defp copy_extra_files(release) do
    File.cp_r("apps/shared/priv/repo/seeds", release.path <> "/seeds")
    release
  end

  defp deps do
    []
  end
end

When I run MIX_ENV=qa mix release my_app, it created a seeds directory under _build/qa/rel/my_app, but when I extract the generated tar ball, it does not contain the seeds directory.

Is it possible that my copy_extra_files/1 is wrong?

Elixir version is 1.11.3.

Where Next?

Popular in Questions Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement