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

myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
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
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
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
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement