monometa

Untitled

Jun 29th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. ARG PYTHON_VERSION=3.9.18
  2.  
  3. FROM --platform=linux/amd64 amazonlinux:2 AS base
  4. ARG PYTHON_VERSION
  5.  
  6. RUN yum install -y gcc openssl11-devel bzip2-devel libffi-devel tar gzip wget make && \
  7. wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
  8. tar xzf Python-${PYTHON_VERSION}.tgz && \
  9. cd Python-${PYTHON_VERSION} && \
  10. ./configure --enable-optimizations && \
  11. make install
  12.  
  13.  
  14. RUN yum install -y python3 tar gzip
  15. RUN yum -y update && yum -y install \
  16. curl \
  17. java-1.8.0-openjdk \
  18. java-1.8.0-openjdk-devel \
  19. && yum clean all
  20.  
  21. ENV VIRTUAL_ENV=/opt/venv
  22. RUN python3 -m venv $VIRTUAL_ENV --copies
  23. RUN cp -r /usr/local/lib/python3.9/* $VIRTUAL_ENV/lib/python3.9/
  24.  
  25. # Ensure our python3 executable references the virtual environment
  26. ENV PATH="$VIRTUAL_ENV/bin:$PATH"
  27.  
  28. ENV PATH="${PATH}:/root/.local/bin"
  29.  
  30. # RUN python3 -m pip poetry
  31. RUN python3 -m pip install --upgrade pip && \
  32. python3 -m pip install venv-pack==0.2.0
  33.  
  34. # ENV PATH="$PATH:/root/.local/bin"
  35.  
  36. WORKDIR /app
  37.  
  38. COPY . .
  39.  
  40. FROM base as build-poetry
  41. ARG PYTHON_VERSION
  42. # RUN export PATH="$HOME/.poetry/bin:$PATH"
  43. RUN poetry self add poetry-plugin-bundle && \
  44. poetry bundle venv dist/bundle
  45.  
  46.  
  47. RUN mkdir /output && \
  48. venv-pack -o /output/pyspark_${PYTHON_VERSION}.tar.gz --prefix dist/bundle --python-prefix /home/hadoop/environment
  49.  
  50. FROM scratch as export-poetry
  51. ARG PYTHON_VERSION
  52. COPY --from=build-poetry /output/pyspark_${PYTHON_VERSION}.tar.gz /
Advertisement
Add Comment
Please, Sign In to add comment