phoenix.dockerfile 771 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. ARG ELIXIR="1.14.5"
  2. ARG ERLANG="26.0"
  3. ARG ALPINE="3.17.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 mix local.hex --force && \
  9. mix local.rebar --force
  10. COPY mix.exs mix.lock ./
  11. RUN mix deps.get --force --only prod
  12. COPY config ./config
  13. RUN mix deps.compile
  14. COPY priv ./priv
  15. COPY lib ./lib
  16. COPY rel ./rel
  17. RUN mix release --force --path /export
  18. # start a new build stage so that the final image will only contain
  19. # the compiled release and other runtime necessities
  20. FROM ${RUNNER_IMAGE}
  21. RUN apk add --no-cache libstdc++ openssl ncurses-libs
  22. COPY --from=builder /export /opt
  23. EXPOSE 8080
  24. ENTRYPOINT ["/opt/bin/hello"]
  25. CMD ["start"]