larshei

larshei

Docker image build for umbrella app gets stuck at esbuild download

I want to build a docker image for a release of an umbrella phoenix app, but get stuck at installing esbuild:

#24 [build 14/20] RUN mix esbuild --no-runtime-config default --minify
#24 1.204 10:00:19.345 [warning] esbuild version is not configured. Please set it in your config files:
#24 1.204 
#24 1.204     config :esbuild, :version, "0.17.11"
#24 1.204 
#24 1.211 
#24 1.211 10:00:19.354 [debug] Downloading esbuild from https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.11.tgz

Two things are surprising me here:

  1. I have set up the esbuild version my config/config.exs file and therefore do not understand the warning.
    config :esbuild,
      version: "0.17.11",
      ...
    
  2. When opening the download link in my browser, the download is done almost immediately. However, in the docker build process, nothing seems to happen. I have tried multiple times and waited up to 15 minutes for the download.

As a test, I run a docker build for a previous, non-umbrella project, and all worked well.
Have you run into this before or have an idea, what the cause may be?

Dockerfile
FROM elixir:1.15-alpine AS build

# prepare build dir
WORKDIR /app

# install hex/rebar package managers
RUN mix local.hex --force && \
    mix local.rebar --force

# Pulls in build packages required to build NIFs for bcrypt_elixir
RUN apk add build-base

# GIT is required for some github project dependencies
RUN apk add git
ARG GITHUB_USERNAME
ARG GITHUB_TOKEN
RUN git config --global url."https://$GITHUB_USERNAME:$GITHUB_TOKEN@github.com/".insteadOf "https://github.com/"

ENV MIX_ENV=prod

# Copy mix files that contain dependency lists. We do this separately to be able to cache deps between builds.
COPY mix.exs .
COPY mix.lock .
COPY apps/my_app/mix.exs apps/my_app/mix.exs
COPY apps/my_app_web/mix.exs apps/my_app_web/mix.exs

# install and compile mix dependencies
RUN mix deps.get --only prod
RUN mix deps.compile

# Digest assets
COPY apps/my_app_web/priv apps/my_app_web/assets apps/my_app_web/
RUN mix esbuild --no-runtime-config default --minify
RUN mix phx.digest

# Copy and compile apps
WORKDIR /app
COPY apps/my_app/lib apps/my_app/priv apps/my_app/test apps/my_app/
COPY apps/my_app_web/lib apps/my_app_web/test apps/my_app_web/mix.exs apps/my_app_web/
RUN mix compile

# Build release
RUN mix release

# Build minimal runtime container wihtout build tools etc
FROM alpine:3.18 AS app

# Required for Erlang
RUN apk add --no-cache openssl ncurses-libs libgcc libstdc++

WORKDIR /app

COPY --from=build /app/_build/prod/rel/my_app_umbrella ./
COPY --from=build /app/bin ./bin
ENV HOME=/app

EXPOSE 4000

CMD bin/my_app_umbrella start

Marked As Solved

nallwhy

nallwhy

You don’t copy configs.

RUN mkdir config
COPY config/config.exs config/${MIX_ENV}.exs config/

Also Liked

dimitarvp

dimitarvp

Might not be the answer that you’re after – but why don’t you just install esbuild with apk inside the container?

larshei

larshei

:man_facepalming:

Thanks.

Ye good idea, but with corrected configs it worked as intended.

Where Next?

Popular in Questions Top

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
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
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
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
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
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 t...
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
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
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
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 31265 143
New
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
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
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

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement