ARG IMAGE=elixir:1.16.2-otp-26-alpine FROM $IMAGE RUN apk add build-base git WORKDIR /app # To generate mix cache RUN mix local.hex --force \ && mix local.rebar --force COPY mix.* . # To generate compiled deps cache RUN mix deps.get \ && MIX_ENV=test mix deps.compile \ && MIX_ENV=prod mix deps.compile # Ensure use of .dockerignore file to avoid copying unnecessary files COPY . . # To generate compiled application and run static code analysis RUN mix ca.release CMD while true; do \ echo "This is an infinite loop until files are copied and container destroyed."; \ sleep 5; \ done