fix: install hex/rebar inside cache-mounted RUN steps in Dockerfile

The --mount=type=cache,target=/root/.mix overlays shadow the hex
installation done in the prior non-cached RUN step. With a cold cache
the hex archive is absent, causing 'Could not find an SCM for dependency'
errors. Install hex and rebar inside each cache-mounted step instead.
This commit is contained in:
Graham McIntire 2026-02-17 16:59:27 -06:00
parent 68826dc89b
commit b765d6d6ce
No known key found for this signature in database

View file

@ -46,6 +46,8 @@ COPY mix.exs mix.lock ./
COPY vendor vendor
RUN --mount=type=cache,target=/root/.hex \
--mount=type=cache,target=/root/.mix \
mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only $MIX_ENV
RUN mkdir config
@ -55,6 +57,8 @@ RUN mkdir config
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN --mount=type=cache,target=/root/.hex \
--mount=type=cache,target=/root/.mix \
mix local.hex --force && \
mix local.rebar --force && \
mix deps.compile
RUN --mount=type=cache,target=/root/.mix \