11# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
22# instead of Alpine to avoid DNS resolution issues in production.
33#
4- # https://hub.docker.com/r/hexpm/elixir/tags?page=1& name=ubuntu
5- # https://hub.docker.com/_/ubuntu?tab= tags
4+ # https://hub.docker.com/r/hexpm/elixir/tags?name=ubuntu
5+ # https://hub.docker.com/_/ubuntu/ tags
66#
77# This file is based on these images:
88#
99# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
10- # - https://hub.docker.com/_/debian?tab= tags&page=1& name=bullseye-20240701 -slim - for the release image
10+ # - https://hub.docker.com/_/debian/ tags? name=bookworm-20251103 -slim - for the release image
1111# - https://pkgs.org/ - resource for finding needed packages
12- # - Ex: hexpm/elixir:1.17.2 -erlang-27.0 -debian-bullseye-20240701 -slim
12+ # - Ex: docker.io/ hexpm/elixir:1.19.1 -erlang-28.1.1 -debian-bookworm-20251103 -slim
1313#
14- ARG ELIXIR_VERSION=1.17.2
15- ARG OTP_VERSION=27.0
16- ARG DEBIAN_VERSION=bullseye-20240701 -slim
14+ ARG ELIXIR_VERSION=1.19.1
15+ ARG OTP_VERSION=28.1.1
16+ ARG DEBIAN_VERSION=bookworm-20251103 -slim
1717
18- ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
19- ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
18+ ARG BUILDER_IMAGE="docker.io/ hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
19+ ARG RUNNER_IMAGE="docker.io/ debian:${DEBIAN_VERSION}"
2020
21- FROM ${BUILDER_IMAGE} as builder
21+ FROM ${BUILDER_IMAGE} AS builder
2222
2323# install build dependencies
24- RUN apt-get update -y && apt-get install -y build-essential git \
25- && apt-get clean && rm -f /var/lib/apt/lists/*_*
24+ RUN apt-get update \
25+ && apt-get install -y --no-install-recommends build-essential git \
26+ && rm -rf /var/lib/apt/lists/*
2627
2728# prepare build dir
2829WORKDIR /app
2930
3031# install hex + rebar
31- RUN mix local.hex --force && \
32- mix local.rebar --force
32+ RUN mix local.hex --force \
33+ && mix local.rebar --force
3334
3435# set build ENV
3536ENV MIX_ENV="prod"
@@ -45,18 +46,20 @@ RUN mkdir config
4546COPY config/config.exs config/${MIX_ENV}.exs config/
4647RUN mix deps.compile
4748
49+ RUN mix assets.setup
50+
4851COPY priv priv
4952
5053COPY lib lib
5154
55+ # Compile the release
56+ RUN mix compile
57+
5258COPY assets assets
5359
5460# compile assets
5561RUN mix assets.deploy
5662
57- # Compile the release
58- RUN mix compile
59-
6063# Changes to config/runtime.exs don't require recompiling the code
6164COPY config/runtime.exs config/
6265
@@ -65,18 +68,19 @@ RUN mix release
6568
6669# start a new build stage so that the final image will only contain
6770# the compiled release and other runtime necessities
68- FROM ${RUNNER_IMAGE}
71+ FROM ${RUNNER_IMAGE} AS final
6972
70- RUN apt-get update -y && \
71- apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \
72- && apt-get clean && rm -f /var/lib/apt/lists/*_ *
73+ RUN apt-get update \
74+ && apt-get install -y --no-install-recommends libstdc++6 openssl libncurses5 locales ca-certificates \
75+ && rm -rf /var/lib/apt/lists/*
7376
7477# Set the locale
75- RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
78+ RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
79+ && locale-gen
7680
77- ENV LANG en_US.UTF-8
78- ENV LANGUAGE en_US:en
79- ENV LC_ALL en_US.UTF-8
81+ ENV LANG= en_US.UTF-8
82+ ENV LANGUAGE= en_US:en
83+ ENV LC_ALL= en_US.UTF-8
8084
8185WORKDIR "/app"
8286RUN chown nobody /app
0 commit comments