fix: use official hexpm/elixir images instead of erlang-solutions repo

The Erlang Solutions APT repository was experiencing 504 Gateway Timeout
errors during builds, making the image build process unreliable.

Changes:
- Use official hexpm/elixir Docker image as builder stage
- More reliable (official Docker Hub images)
- Faster builds (pre-built binaries, no package installation)
- Still produces minimal runtime-only final image
- Updated documentation to reflect new approach

Benefits:
- No dependency on erlang-solutions CDN availability
- Faster build times (no apt-get install of large packages)
- Same minimal final image size (~150-200 MB)
- Easier to specify exact Erlang/Elixir versions
This commit is contained in:
Graham McIntire 2026-01-25 09:21:42 -06:00
parent d92443d91b
commit 7685fa53d1
No known key found for this signature in database
2 changed files with 9 additions and 29 deletions

View file

@ -1,5 +1,5 @@
# Minimal Debian 13 (Trixie) with Erlang/OTP and Elixir runtime # Minimal Debian 13 (Trixie) with Erlang/OTP and Elixir runtime
# Built from scratch with only essential packages # Uses official hexpm/elixir images as builder for reliability
# #
# This image is designed to be rebuilt regularly to get latest security updates # This image is designed to be rebuilt regularly to get latest security updates
@ -7,30 +7,10 @@ ARG DEBIAN_VERSION=trixie-20251229-slim
ARG ERLANG_VERSION=28.3 ARG ERLANG_VERSION=28.3
ARG ELIXIR_VERSION=1.19.5 ARG ELIXIR_VERSION=1.19.5
FROM docker.io/debian:${DEBIAN_VERSION} as builder # 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
# Install build dependencies (will be removed in final image) # Verify installations in builder
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
ca-certificates \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# Add Erlang Solutions repository for latest Erlang/OTP
RUN wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | \
gpg --dearmor -o /usr/share/keyrings/erlang-solutions.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/erlang-solutions.gpg] https://packages.erlang-solutions.com/debian trixie contrib" \
> /etc/apt/sources.list.d/erlang.list
# Install Erlang/OTP and Elixir
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
esl-erlang \
elixir \
&& rm -rf /var/lib/apt/lists/*
# Verify installations
RUN erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell RUN erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
RUN elixir --version RUN elixir --version

View file

@ -42,8 +42,8 @@ chmod +x build.sh
``` ```
This builds a multi-stage Docker image with: This builds a multi-stage Docker image with:
- **Builder stage**: Installs Erlang and Elixir from Erlang Solutions repository - **Builder stage**: Uses official hexpm/elixir image with pre-built Erlang/Elixir
- **Final stage**: Minimal Debian with only runtime dependencies - **Final stage**: Minimal Debian with only runtime dependencies copied from builder
### Updating System Packages ### Updating System Packages
@ -191,8 +191,8 @@ rebuild-base-image:
### Image fails to build ### Image fails to build
```bash ```bash
# Check if Erlang Solutions repository is accessible # Check if hexpm images are accessible
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc docker pull hexpm/elixir:1.19.5-erlang-28.3-debian-trixie-20251229-slim
# Try building with verbose output # Try building with verbose output
docker build --progress=plain --no-cache -f Dockerfile . docker build --progress=plain --no-cache -f Dockerfile .
@ -237,6 +237,6 @@ We use **Debian** instead of Alpine because:
## See Also ## See Also
- [Erlang Solutions Packages](https://www.erlang-solutions.com/downloads/) - [hexpm/elixir Docker Images](https://hub.docker.com/r/hexpm/elixir)
- [Elixir Installation Guide](https://elixir-lang.org/install.html) - [Elixir Installation Guide](https://elixir-lang.org/install.html)
- [Docker Multi-Stage Builds](https://docs.docker.com/build/building/multi-stage/) - [Docker Multi-Stage Builds](https://docs.docker.com/build/building/multi-stage/)