zoedsoupe

zoedsoupe

Why my final docker image didn’t find umbrella applications?

I build a Dockerfile as:

FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.17.5 AS releaser

RUN apk add --no-cache build-base git python3 curl

WORKDIR /app

RUN mix do local.hex --force, local.rebar --force

COPY config/ ./config/
COPY mix.exs mix.lock ./

COPY apps/liquid_auth/mix.exs ./apps/liquid_auth/
COPY apps/liquid_accounts/mix.exs ./apps/liquid_accounts/
COPY apps/liquid_operations/mix.exs ./apps/liquid_operations/
COPY apps/proxy_web/mix.exs ./apps/proxy_web/
COPY apps/release/mix.exs ./apps/release/

COPY apps/liquid_auth/priv ./apps/liquid_auth/
COPY apps/liquid_accounts/priv ./apps/liquid_accounts/
COPY apps/liquid_operations/priv ./apps/liquid_operations/

ENV MIX_ENV=prod

RUN mix deps.get
RUN mix deps.compile

COPY apps/liquid_auth/lib/ ./apps/liquid_auth/
COPY apps/liquid_accounts/lib/ ./apps/liquid_accounts/
COPY apps/liquid_operations/lib/ ./apps/liquid_operations/
COPY apps/proxy_web/lib/ ./apps/proxy_web/
COPY apps/release/lib/ ./apps/release/

RUN mix compile --force
RUN mix release

FROM alpine:3.17.5 AS app

RUN apk add --no-cache libstdc++ openssl ncurses-libs

EXPOSE 4000

ENV PORT=4000 \
    MIX_ENV=prod \
    SHELL=/bin/bash \
    PHX_SERVER=true

WORKDIR /app

COPY --from=releaser /app/_build/prod/rel/liquid ./

CMD ["bin/liquid", "eval", "Release.migrate", "&&", "exec", "bin/liquid", "start"]

and this is my docker-compose.yml:

 version: "3.8"

services:
  pescarte:
    build:
      context: .
    container_name: liquid_dev
    ports:
      - 4000:4000
    depends_on:
      - database
    env_file:
      - .env-sample
    volumes:
      - .:/src
    environment:
      MIX_ENV: dev
    stdin_open: true
    tty: true

  database:
    image: postgres:14.6
    container_name: liquid_database
    environment:
      - POSTGRES_USER=liquid
      - POSTGRES_PASSWORD=liquid
    ports:
      - 5432:5432
    volumes:
      - .postgres:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U liquid -d liquid" ]
      interval: 5s
      timeout: 2s
      retries: 1

However when i try to run docker compose up I get this error:

 liquid_dev       | ** (UndefinedFunctionError) function Release.migrate/0 is undefined (module Release is not available)
liquid_dev       |     Release.migrate()
liquid_dev       |     nofile:1: (file)
liquid_dev       |     (stdlib 5.1.1) erl_eval.erl:750: :erl_eval.do_apply/7
liquid_dev       |     (elixir 1.15.7) lib/code.ex:543: Code.validated_eval_string/3
liquid_dev exited with code 1

The full repository with the source code (empty phoenix apps) can be found here

And trying to build with docker build -t liquid-pescarte —no-cache —progress plain . gives all correct instructions and it compiles down all my umbrella apps, so I didn’t understand why on the runtime its brokes.

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
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
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
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
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement