diff --git a/Dockerfile b/Dockerfile index a3537981..efbb28d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,16 +40,22 @@ ENV MIX_ENV="prod" # install mix dependencies COPY mix.exs mix.lock ./ -RUN mix deps.get --only $MIX_ENV +RUN --mount=type=cache,target=/root/.hex \ + --mount=type=cache,target=/root/.mix \ + mix deps.get --only $MIX_ENV RUN mkdir config # copy compile-time config files before we compile dependencies # to ensure any relevant config change will trigger the dependencies # to be re-compiled. COPY config/config.exs config/${MIX_ENV}.exs config/ -RUN mix deps.compile +RUN --mount=type=cache,target=/root/.hex \ + --mount=type=cache,target=/root/.mix \ + mix deps.compile -RUN mix assets.setup +RUN --mount=type=cache,target=/root/.mix \ + --mount=type=cache,target=/root/.npm \ + mix assets.setup COPY priv priv diff --git a/k8s/Dockerfile b/k8s/Dockerfile index a3537981..efbb28d3 100644 --- a/k8s/Dockerfile +++ b/k8s/Dockerfile @@ -40,16 +40,22 @@ ENV MIX_ENV="prod" # install mix dependencies COPY mix.exs mix.lock ./ -RUN mix deps.get --only $MIX_ENV +RUN --mount=type=cache,target=/root/.hex \ + --mount=type=cache,target=/root/.mix \ + mix deps.get --only $MIX_ENV RUN mkdir config # copy compile-time config files before we compile dependencies # to ensure any relevant config change will trigger the dependencies # to be re-compiled. COPY config/config.exs config/${MIX_ENV}.exs config/ -RUN mix deps.compile +RUN --mount=type=cache,target=/root/.hex \ + --mount=type=cache,target=/root/.mix \ + mix deps.compile -RUN mix assets.setup +RUN --mount=type=cache,target=/root/.mix \ + --mount=type=cache,target=/root/.npm \ + mix assets.setup COPY priv priv