From aa01c16dd916f35d1f42fc7db7e608cb28d93858 Mon Sep 17 00:00:00 2001 From: Charles Renwick Date: Thu, 22 Feb 2024 05:59:20 -0500 Subject: [PATCH] Updates release guide Docker example (#5729) --- guides/deployment/releases.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/guides/deployment/releases.md b/guides/deployment/releases.md index 882b1a90be..5fb32f5bff 100644 --- a/guides/deployment/releases.md +++ b/guides/deployment/releases.md @@ -158,23 +158,22 @@ Elixir releases work well with container technologies, such as Docker. The idea If you call `mix phx.gen.release --docker` you'll see a new file with these contents: ```Dockerfile -# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian instead of -# Alpine to avoid DNS resolution issues in production. +# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian +# instead of Alpine to avoid DNS resolution issues in production. # # https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu # https://hub.docker.com/_/ubuntu?tab=tags # -# # This file is based on these images: # # - https://hub.docker.com/r/hexpm/elixir/tags - for the build image -# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image +# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20230612-slim - for the release image # - https://pkgs.org/ - resource for finding needed packages -# - Ex: hexpm/elixir:1.14.0-erlang-24.3.4-debian-bullseye-20210902-slim +# - Ex: hexpm/elixir:1.14.5-erlang-25.3.2.4-debian-bullseye-20230612-slim # -ARG ELIXIR_VERSION=1.14.0 -ARG OTP_VERSION=24.3.4 -ARG DEBIAN_VERSION=bullseye-20210902-slim +ARG ELIXIR_VERSION=1.14.5 +ARG OTP_VERSION=25.3.2.4 +ARG DEBIAN_VERSION=bullseye-20230612-slim ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}" @@ -208,18 +207,14 @@ RUN mix deps.compile COPY priv priv -# note: if your project uses a tool like https://purgecss.com/, -# which customizes asset compilation based on what it finds in -# your Elixir templates, you will need to move the asset compilation -# step down so that `lib` is available. +COPY lib lib + COPY assets assets # compile assets RUN mix assets.deploy # Compile the release -COPY lib lib - RUN mix compile # Changes to config/runtime.exs don't require recompiling the code @@ -232,7 +227,8 @@ RUN mix release # the compiled release and other runtime necessities FROM ${RUNNER_IMAGE} -RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \ +RUN apt-get update -y && \ + apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \ && apt-get clean && rm -f /var/lib/apt/lists/*_* # Set the locale @@ -258,7 +254,7 @@ USER nobody # above and adding an entrypoint. See https://github.com/krallin/tini for details # ENTRYPOINT ["/tini", "--"] -CMD /app/bin/server +CMD ["/app/bin/server"] ``` Where `my_app` is the name of your app. At the end, you will have an application in `/app` ready to run as `/app/bin/server`.