diff --git a/k8s/Dockerfile b/k8s/Dockerfile index 608fac74..c1bcdb72 100644 --- a/k8s/Dockerfile +++ b/k8s/Dockerfile @@ -1,5 +1,3 @@ -# syntax=docker/dockerfile:1.4 - # Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian # instead of Alpine to avoid DNS resolution issues in production. # @@ -38,30 +36,22 @@ WORKDIR /app ENV MIX_ENV="prod" # install hex + rebar -RUN --mount=type=cache,target=/root/.hex \ - --mount=type=cache,target=/root/.mix \ - mix local.hex --force \ +RUN mix local.hex --force \ && mix local.rebar --force # install mix dependencies COPY mix.exs mix.lock ./ COPY vendor vendor -RUN --mount=type=cache,target=/root/.hex \ - --mount=type=cache,target=/root/.mix \ - mix deps.get --only $MIX_ENV +RUN 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 --mount=type=cache,target=/root/.hex \ - --mount=type=cache,target=/root/.mix \ - mix deps.compile +RUN mix deps.compile -RUN --mount=type=cache,target=/root/.mix \ - --mount=type=cache,target=/root/.npm \ - mix assets.setup +RUN mix assets.setup COPY priv priv @@ -73,21 +63,18 @@ RUN cd c_src && make COPY lib lib # Compile the release -RUN --mount=type=cache,target=/root/.mix \ - mix compile +RUN mix compile COPY assets assets # compile assets -RUN --mount=type=cache,target=/root/.mix \ - mix assets.deploy +RUN mix assets.deploy # Changes to config/runtime.exs don't require recompiling the code COPY config/runtime.exs config/ COPY rel rel -RUN --mount=type=cache,target=/root/.mix \ - mix release +RUN mix release # start a new build stage so that the final image will only contain # the compiled release and other runtime necessities