Update Dockerfile

Signed-off-by: arndttouby <arndt@touby.eu>
This commit is contained in:
Arndt Touby 2025-12-16 08:22:53 +00:00
parent 56f7659ad2
commit cb12a01dc9

View file

@ -11,9 +11,9 @@
# - https://pkgs.org/ - resource for finding needed packages
# - Ex: hexpm/elixir:1.18.1-erlang-27.2-debian-bookworm-20250113-slim
#
ARG ELIXIR_VERSION=1.18.3
ARG OTP_VERSION=27.3
ARG DEBIAN_VERSION=bookworm-20250317-slim
ARG ELIXIR_VERSION=1.19.4
ARG OTP_VERSION=28.3
ARG DEBIAN_VERSION=trixie-20251208-slim
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
@ -21,18 +21,13 @@ ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} AS package_installer
# install build dependencies
RUN apt-get update -y && apt-get install -y build-essential \
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
git \
locales \
curl \
inotify-tools
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get update -y && apt-get install -y nodejs \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
RUN npm install -g npm@latest
RUN apt-get clean && rm -f /var/lib/apt/lists/*_*
# prepare build dir
WORKDIR /app
@ -67,6 +62,8 @@ RUN mkdir config
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
RUN mix assets.setup
COPY priv priv
COPY lib lib
@ -87,18 +84,18 @@ RUN mix release
####################################################################################################
# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}
FROM ${RUNNER_IMAGE} as final
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/*_*
RUN apt-get update \
&& apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 locales ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
RUN sed -i '/de_DE.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV LANG=de_DE.UTF-8
ENV LANGUAGE=de_DE:de
ENV LC_ALL=de_DE.UTF-8
WORKDIR "/app"
RUN chown nobody /app
@ -107,7 +104,7 @@ RUN chown nobody /app
ENV MIX_ENV="prod"
# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/phx_db ./
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/bmt_checkout ./
# Copy the tailwind-cli binary used to compile stylesheets for pages
RUN mkdir -p ./bin/_build