The hexpm images install Erlang and Elixir in /usr/local instead of /usr/lib. Changes: - Copy from /usr/local/lib/erlang instead of /usr/lib/erlang - Copy all Erlang/Elixir binaries from /usr/local/bin - Remove manual symlink creation (binaries already exist) - Binaries are symlinks to ../lib/erlang/bin and ../lib/elixir/bin
75 lines
2.6 KiB
Docker
75 lines
2.6 KiB
Docker
# Minimal Debian 13 (Trixie) with Erlang/OTP and Elixir runtime
|
|
# Uses official hexpm/elixir images as builder for reliability
|
|
#
|
|
# This image is designed to be rebuilt regularly to get latest security updates
|
|
|
|
ARG DEBIAN_VERSION=trixie-20251229-slim
|
|
ARG ERLANG_VERSION=28.3
|
|
ARG ELIXIR_VERSION=1.19.5
|
|
|
|
# Use official Elixir image as builder (more reliable than erlang-solutions repo)
|
|
FROM docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-debian-${DEBIAN_VERSION} as builder
|
|
|
|
# Verify installations in builder
|
|
RUN erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
|
|
RUN elixir --version
|
|
|
|
# Final minimal runtime image
|
|
FROM docker.io/debian:${DEBIAN_VERSION}
|
|
|
|
LABEL maintainer="towerops"
|
|
LABEL description="Minimal Debian 13 with Erlang/OTP and Elixir runtime"
|
|
|
|
# Copy Erlang and Elixir from builder (hexpm image uses /usr/local)
|
|
COPY --from=builder /usr/local/lib/erlang /usr/local/lib/erlang
|
|
COPY --from=builder /usr/local/lib/elixir /usr/local/lib/elixir
|
|
|
|
# Copy all Erlang/Elixir binaries (they're symlinks to lib dirs)
|
|
COPY --from=builder /usr/local/bin/erl /usr/local/bin/erl
|
|
COPY --from=builder /usr/local/bin/erlc /usr/local/bin/erlc
|
|
COPY --from=builder /usr/local/bin/escript /usr/local/bin/escript
|
|
COPY --from=builder /usr/local/bin/epmd /usr/local/bin/epmd
|
|
COPY --from=builder /usr/local/bin/elixir /usr/local/bin/elixir
|
|
COPY --from=builder /usr/local/bin/elixirc /usr/local/bin/elixirc
|
|
COPY --from=builder /usr/local/bin/iex /usr/local/bin/iex
|
|
COPY --from=builder /usr/local/bin/mix /usr/local/bin/mix
|
|
|
|
# Install only essential runtime dependencies
|
|
# This is the absolute minimum needed for Erlang/Elixir + Phoenix apps
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
# Erlang runtime dependencies
|
|
libssl3 \
|
|
libsctp1 \
|
|
libncurses6 \
|
|
libstdc++6 \
|
|
# System utilities
|
|
ca-certificates \
|
|
locales \
|
|
# Network utilities (minimal set)
|
|
iputils-ping \
|
|
iproute2 \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& apt-get clean
|
|
|
|
# Configure locale (required for proper string handling)
|
|
RUN sed -i '/en_US.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
|
|
|
|
# Add nobody user for security (already exists in Debian)
|
|
RUN mkdir -p /app && chown nobody:nogroup /app
|
|
|
|
WORKDIR /app
|
|
USER nobody
|
|
|
|
# Verify everything works
|
|
RUN erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
|
|
RUN elixir --version
|
|
|
|
# Default command - override in application Dockerfile
|
|
CMD ["/bin/bash"]
|