92 lines
2.7 KiB
Docker
92 lines
2.7 KiB
Docker
# Dockerfile for Debian build environment
|
|
# Automates all setup steps from the build-debian workflow job
|
|
#
|
|
# Usage:
|
|
# docker build -f scripts/docker/Dockerfile.debian -t android-file-handler-debian-builder .
|
|
# docker run -v $(pwd):/workspace -w /workspace android-file-handler-debian-builder
|
|
|
|
# Use Debian 13 "Trixie" (latest stable release)
|
|
FROM debian:13
|
|
|
|
# Set build arguments
|
|
ARG FPM_VERSION=1.16.0
|
|
ARG PYTHON_VERSION=3.14.3
|
|
ARG PYTHON_SHA256=d7fe130d0501ae047ca318fa92aa642603ab6f217901015a1df6ce650d5470cd
|
|
|
|
# Install system dependencies including Python build dependencies
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
curl \
|
|
git \
|
|
build-essential \
|
|
ruby \
|
|
ruby-dev \
|
|
gcc \
|
|
make \
|
|
zlib1g-dev \
|
|
ca-certificates \
|
|
tcl-dev \
|
|
tk-dev \
|
|
libx11-6 \
|
|
libxext6 \
|
|
libxrender1 \
|
|
libxcb1 \
|
|
libbz2-dev \
|
|
libreadline-dev \
|
|
libsqlite3-dev \
|
|
libssl-dev \
|
|
libffi-dev \
|
|
wget \
|
|
tar \
|
|
liblzma-dev \
|
|
patch && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download Python source and verify SHA256 checksum against python.org
|
|
RUN wget -q "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
|
|
-O /tmp/Python-${PYTHON_VERSION}.tgz && \
|
|
echo "${PYTHON_SHA256} /tmp/Python-${PYTHON_VERSION}.tgz" | sha256sum -c -
|
|
|
|
# Build and install Python from source
|
|
RUN cd /tmp && tar xzf Python-${PYTHON_VERSION}.tgz && \
|
|
cd Python-${PYTHON_VERSION} && \
|
|
LDFLAGS="-L/usr/lib/x86_64-linux-gnu" \
|
|
CPPFLAGS="-I/usr/include/tcl8.6" \
|
|
./configure --enable-shared --with-ensurepip=install --prefix=/usr/local && \
|
|
make -j$(nproc) && \
|
|
make install && \
|
|
echo "/usr/local/lib" > /etc/ld.so.conf.d/python.conf && \
|
|
ldconfig && \
|
|
ln -sf /usr/local/bin/python3 /usr/local/bin/python && \
|
|
rm -rf /tmp/Python-${PYTHON_VERSION} /tmp/Python-${PYTHON_VERSION}.tgz
|
|
|
|
# Update PATH to include Python installation
|
|
ENV PATH="/usr/local/bin:$PATH"
|
|
|
|
# Verify Python has tkinter support
|
|
RUN python3 -c "import tkinter; import _tkinter; print('tkinter support verified')" || \
|
|
(echo "ERROR: Python was built without tkinter support" && exit 1)
|
|
|
|
# Install Poetry
|
|
RUN curl -sSL https://install.python-poetry.org | python3 - --yes
|
|
|
|
# Add Poetry to PATH
|
|
ENV PATH="/root/.local/bin:$PATH"
|
|
|
|
# Verify Poetry installation
|
|
RUN poetry --version
|
|
|
|
# Install fpm
|
|
RUN gem install --no-document -v "${FPM_VERSION}" fpm
|
|
|
|
# Set working directory
|
|
WORKDIR /workspace
|
|
|
|
# Set environment variables for build
|
|
ENV CI_CD=true
|
|
ENV DISTRO_TYPE=debian
|
|
|
|
# Default command runs the build script
|
|
CMD ["sh", "-c", "poetry install --no-interaction && poetry run python scripts/build_package_linux.py"]
|