From bd3f872776d0dd3ca88511ad61fdaa0e7c15cdc0 Mon Sep 17 00:00:00 2001 From: graham Date: Sat, 28 Mar 2026 12:31:22 -0500 Subject: [PATCH] fix/docker-build-permissions (#207) Reviewed-on: https://git.mcintire.me/graham/towerops-web/pulls/207 --- k8s/Dockerfile | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) 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