104 lines
2.9 KiB
Docker
104 lines
2.9 KiB
Docker
# Dockerfile for Arch Linux build environment
|
|
# Automates all setup steps from the build-arch workflow job
|
|
#
|
|
# Usage:
|
|
# docker build -f scripts/docker/Dockerfile.arch -t android-file-handler-arch-builder .
|
|
# docker run -v $(pwd):/workspace -w /workspace android-file-handler-arch-builder
|
|
|
|
# Use latest Arch Linux base image (rolling release)
|
|
# For reproducibility, pin to a specific date tag like: archlinux:base-20251016
|
|
FROM archlinux:latest
|
|
|
|
# Set build argument for fpm version (can be overridden at build time)
|
|
ARG FPM_VERSION=1.16.0
|
|
|
|
# Install system dependencies (Arch) including Python build dependencies
|
|
RUN pacman -Syu --noconfirm \
|
|
ruby \
|
|
ruby-bundler \
|
|
ruby-rake \
|
|
base-devel \
|
|
curl \
|
|
git \
|
|
tar \
|
|
ca-certificates \
|
|
ca-certificates-utils \
|
|
tk \
|
|
tcl \
|
|
libx11 \
|
|
libxext \
|
|
libxrender \
|
|
libxcb \
|
|
gcc \
|
|
make \
|
|
zlib \
|
|
bzip2 \
|
|
readline \
|
|
sqlite \
|
|
openssl \
|
|
libffi \
|
|
wget \
|
|
xz \
|
|
patch && \
|
|
update-ca-trust && \
|
|
pacman -Scc --noconfirm
|
|
|
|
# Install erb gem (required for fpm on Arch)
|
|
RUN gem install --no-document erb
|
|
|
|
# Install fpm system-wide and pin version so fpm will be in /usr/bin
|
|
# Install fpm and print diagnostic info
|
|
RUN set -euxo pipefail && \
|
|
echo "Ruby version:" && ruby -v && \
|
|
echo "Gem environment:" && gem env && \
|
|
echo "Attempting gem install fpm ${FPM_VERSION}" && \
|
|
gem install -V --no-document -v "${FPM_VERSION}" fpm || { echo "Gem install failed"; exit 1; } && \
|
|
echo "Gem bin dir: $(ruby -e 'puts Gem.bindir')" && \
|
|
ls -l "$(ruby -e 'puts Gem.bindir')" || true && \
|
|
cp -v "$(ruby -e 'puts Gem.bindir')"/* /usr/bin/ || true && \
|
|
fpm --version || echo "fpm missing"
|
|
|
|
|
|
|
|
# Install pyenv
|
|
ENV PYENV_ROOT="/root/.pyenv"
|
|
ENV PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
RUN git clone https://github.com/pyenv/pyenv.git /root/.pyenv
|
|
|
|
# Install Python 3.12 via pyenv with tkinter support
|
|
# The tk and tcl packages must be installed before this step for _tkinter to be compiled
|
|
RUN eval "$(pyenv init -)" && \
|
|
LDFLAGS="-L/usr/lib" \
|
|
CPPFLAGS="-I/usr/include" \
|
|
PYTHON_CONFIGURE_OPTS="--enable-shared" \
|
|
pyenv install 3.13 && \
|
|
pyenv global 3.13 && \
|
|
pyenv rehash
|
|
|
|
# Update PATH to include pyenv shims
|
|
ENV PATH="/root/.pyenv/shims:$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
|
|
|
|
# Set working directory
|
|
WORKDIR /workspace
|
|
|
|
# Set environment variables for build
|
|
ENV CI_CD=true
|
|
ENV DISTRO_TYPE=arch
|
|
|
|
# Default command runs the build script
|
|
CMD ["sh", "-c", "poetry install --no-interaction && poetry run python scripts/build_package_linux.py"]
|