FROM elixir:1.17-alpine AS build RUN apk add --no-cache git nodejs npm build-base WORKDIR /app RUN mix local.hex --force && mix local.rebar --force ENV MIX_ENV=prod # Fetch Elixir deps first (cached layer) COPY mix.exs ./ RUN mix deps.get # Install JS deps from the now-fetched phoenix/phoenix_live_view deps COPY assets/package.json assets/ RUN cd assets && npm install # Copy source and compile COPY config config COPY lib lib COPY priv priv COPY assets assets RUN mix deps.compile RUN mix assets.deploy RUN mix compile RUN mix phx.digest EXPOSE 4000 CMD ["mix", "phx.server"]