phoenix.dockerfile 801 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ARG ELIXIR="1.17.2"
  2. ARG ERLANG="27.0.1"
  3. ARG ALPINE="3.19.3"
  4. ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR}-erlang-${ERLANG}-alpine-${ALPINE}"
  5. ARG RUNNER_IMAGE="alpine:${ALPINE}"
  6. FROM ${BUILDER_IMAGE} AS builder
  7. ARG MIX_ENV="prod"
  8. RUN apk add --no-cache git
  9. RUN mix local.hex --force && \
  10. mix local.rebar --force
  11. COPY mix.exs mix.lock ./
  12. RUN mix deps.get --force --only prod
  13. COPY config ./config
  14. RUN mix deps.compile
  15. COPY priv ./priv
  16. COPY lib ./lib
  17. COPY rel ./rel
  18. RUN mix release --force --path /export
  19. # start a new build stage so that the final image will only contain
  20. # the compiled release and other runtime necessities
  21. FROM ${RUNNER_IMAGE}
  22. RUN apk add --no-cache libstdc++ openssl ncurses-libs
  23. COPY --from=builder /export /opt
  24. EXPOSE 8080
  25. ENTRYPOINT ["/opt/bin/hello"]
  26. CMD ["start"]