diff --git a/.dockerignore b/.dockerignore index 5d2adff0..55863a32 100644 --- a/.dockerignore +++ b/.dockerignore @@ -44,3 +44,8 @@ erl_crash.dump /assets/node_modules/ /priv/static/assets/ /priv/static/cache_manifest.json + +# Analysis outputs and plans (not needed in container) +/docs/analysis_output*.txt +/docs/plans/ +/.worktrees/ diff --git a/Dockerfile b/Dockerfile index b0609292..66648331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,33 +59,38 @@ RUN mix local.hex --force \ # set build ENV ENV MIX_ENV="prod" -# install mix dependencies +# install mix dependencies (changes only when mix.exs/mix.lock change) COPY mix.exs mix.lock ./ 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 compile-time config before compiling deps +RUN mkdir config COPY config/config.exs config/${MIX_ENV}.exs config/ RUN mix deps.compile +# install esbuild + tailwind binaries (cached until mix.exs changes) RUN mix assets.setup -COPY priv priv +# create priv dir so :code.priv_dir works at compile time +# (actual contents copied after compile to avoid cache busting) +RUN mkdir -p priv/models priv/static +# copy application code and compile COPY lib lib -COPY algo.md algo.md - -# Compile the release RUN mix compile +# copy assets and build (JS/CSS changes don't require recompilation) COPY assets assets - -# compile assets RUN mix assets.deploy -# Changes to config/runtime.exs don't require recompiling the code +# copy priv contents (migrations, ML model, static files) +# after compile so model retraining doesn't bust the compile cache +COPY priv priv + +# algo.md is runtime documentation, not compiled +COPY algo.md algo.md + +# runtime config doesn't require recompilation COPY config/runtime.exs config/ COPY rel rel