diff --git a/scripts/docker/Dockerfile.rhel b/scripts/docker/Dockerfile.rhel new file mode 100644 index 0000000..d769dd6 --- /dev/null +++ b/scripts/docker/Dockerfile.rhel @@ -0,0 +1,74 @@ +# Dockerfile for RHEL/Fedora build environment +# Automates all setup steps from the build-rhel workflow job +# +# Usage: +# docker build -f scripts/docker/Dockerfile.rhel -t android-file-handler-rhel-builder . +# docker run -v $(pwd):/workspace -w /workspace android-file-handler-rhel-builder + +FROM fedora:latest + +# Set build argument for fpm version (can be overridden at build time) +ARG FPM_VERSION=1.16.0 + +# Install system dependencies +RUN dnf -y update && \ + dnf -y install \ + gcc \ + make \ + zlib-devel \ + bzip2 \ + bzip2-devel \ + readline-devel \ + sqlite-devel \ + openssl-devel \ + libffi-devel \ + wget \ + tar \ + git \ + curl \ + ruby \ + rubygems \ + rpm-build \ + redhat-rpm-config \ + gcc-c++ \ + patch \ + which \ + xz-devel && \ + dnf clean all + +# 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 +RUN eval "$(pyenv init -)" && \ + pyenv install 3.12.0 && \ + pyenv global 3.12.0 && \ + pyenv rehash + +# Update PATH to include pyenv shims +ENV PATH="/root/.pyenv/shims:$PATH" + +# 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=rhel + +# Default command runs the build script +CMD ["sh", "-c", "poetry install --no-interaction && poetry run python scripts/build_package_linux.py"]