I want to use Elixir:1.9.1 and Phoenix: 1.4.9, so docker-compose up successfully, but inconsistent Phoenix and Elixir versions mix deps file and Docker-container.
Is there a best setting for matching version consistency?
- Dockerfile
FROM elixir:1.9.1
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get install -y nodejs
RUN npm install npm@latest -g
RUN mix local.hex --force && \
mix archive.install hex phx_new 1.4.9 --force && \
mix local.rebar --force && \
RUN apt-get install -y inotify-tools
WORKDIR /app
$ docker-compose run web mix phx.new sample --no-ecto
- mix.exs(Why elixir: “~> 1.4” and phoenix, “~> 1.3.4”)
defmodule Sample.Mixfile do
use Mix.Project
def project do
[
app: :sample,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Sample.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.3.4"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"}
]
end
end
In container(Phoenix v1.4.9 is correct, but Elixir 1.8.1 is wrong),
$ docker exec -it CONTAINER_ID bash
root@XXXXXXX:/app# mix phx.new --version
Phoenix v1.4.9
root@XXXXXXX:/app# elixir -v
Erlang/OTP 21 [erts-10.3.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Elixir 1.8.1 (compiled with Erlang/OTP 21)
refs
-
https://github.com/nicbet/docker-phoenix/blob/master/Dockerfile
-
"mix phx.new" creates project with old set of dependencies and "mix phx.server" fails with "plug_cowboy dependency missing"
(I thought it would be related, but I didn’t know what to do…)