Skip to content

Cannot build container anymore #6

@Chaxiraxi

Description

@Chaxiraxi

Debian has changed some packages in their repos, meaning the apt install fail when building the web container.

  • python-certbot-apache -> python3-certbot-apache
  • netcat -> netcat-traditional
  • php-imap doesn't exist anymore since PHP dropped native support for IMAP and needs to manually install an extention
  • libc-client-dev package (and the underlying uw-imap library) was completely removed from the Debian 13 (Trixie) and Ubuntu 24.10+ repositories because the library is unmaintained.

Gemini 3 Pro patched the php-imap and libc-client-dev issues with the follwing web Dockerfile by temporarily adding the Debian 12 (Bookworm) repository to fetch the required legacy library before compiling the IMAP extension via PECL:

FROM debian:latest
ARG fqdn
ARG email

# 1. Install general dependencies (removed php-imap from here)
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
  nano apache2 php libapache2-mod-php curl netcat-traditional certbot python3-certbot-apache openssl \
  php-dev php-pear build-essential libkrb5-dev

# 2. Patch for missing libc-client-dev in Debian 13 (2025)
# Temporarily adds Bookworm (Debian 12) repo to fetch the legacy library
RUN echo "deb http://deb.debian.org/debian bookworm main" > /etc/apt/sources.list.d/bookworm.list && \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libc-client-dev && \
    rm /etc/apt/sources.list.d/bookworm.list && \
    apt-get update

# 3. Install IMAP via PECL (Required for PHP 8.4+)
RUN pecl install imap && \
    PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') && \
    echo "extension=imap.so" > /etc/php/$PHP_VERSION/mods-available/imap.ini && \
    phpenmod imap

# 4. Enable Apache modules (Generic versioning to support PHP 8.x)
RUN a2enmod $(ls /etc/apache2/mods-available/php*.load | cut -d'/' -f5 | sed 's/.load//') && \
    a2enmod rewrite && \
    a2enmod ssl

# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

# Expose apache
EXPOSE 80

# Copy this repo into place.
RUN rm -rf /var/www && mkdir -p /var/www
RUN echo "ServerName $fqdn" >> /etc/apache2/apache2.conf
RUN echo "ServerTokens Prod\nServerSignature Off\nFileETag None" >> /etc/apache2/apache2.conf

# Update the default apache site with the config created.
ADD disposable-mailbox.conf /etc/apache2/sites-enabled/disposable-mailbox.conf
RUN sed -i "s/CHANGEMEFQDN/$fqdn/g" /etc/apache2/sites-enabled/disposable-mailbox.conf && \
    sed -i "s/CHANGEMEMAIL/$email/g" /etc/apache2/sites-enabled/disposable-mailbox.conf && \
    rm /etc/apache2/sites-enabled/000-default.conf

# Entrypoint
ADD entrypoint.sh /root/entrypoint.sh
WORKDIR /root
ENTRYPOINT ["/root/entrypoint.sh"]

There's also Dovecot FATAL error when booting up the stack:

Starting Dovecot
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 1: The first setting must be dovecot_config_version
doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 1: The first setting must be dovecot_config_version
Starting IMAP/POP3 mail server: dovecot failed!

I figured out that the config needed to be migrated from 2.3 to 2.4.1 and after migrating the config like so:

dovecot_config_version = 2.4.1
dovecot_storage_version = 2.4.1

# Protocols
protocols = imap

# Authentication Settings
auth_allow_cleartext = yes
mail_privileged_group = mail

# Mail Storage Settings
# In 2.4, mail_location is split into driver and path.
mail_driver = maildir
mail_path = ~/

# Use mail_inbox_path to point to the specific system INBOX file.
# Note the new variable syntax: %{user} instead of %u.
mail_inbox_path = /var/mail/%{user}

# User/Password Database Blocks (Names are now required)
userdb local_system {
  driver = passwd
}

passdb local_pam {
  driver = pam
  # PAM usually doesn't need explicit args for the service name,
  # but you can specify 'args = dovecot' if needed.
}

I had to tweak the web/disposable-mailbox.conf file for the stack to work on my reverse proxy, yet, I kept gettig 500 errors and ended up giving up on deploying this heavily outdated project. I hope I gave you enough info for you to start updating it and maintaining it. Also do it your own way and you don't have to trust the AI generated slop Gemini gave me (altough its fixes works so far)

Also using the latest tag is prone to breaking changes when the base image updates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions