Skip to content

Instantly share code, notes, and snippets.

@lynsei
Created February 24, 2025 20:16
Show Gist options
  • Save lynsei/bee853d733f37c6e0da474dccd704185 to your computer and use it in GitHub Desktop.
Save lynsei/bee853d733f37c6e0da474dccd704185 to your computer and use it in GitHub Desktop.
[python3] the #best #pyenv #image for #python3
# syntax=docker/dockerfile:1.3
FROM --platform=$BUILDPLATFORM bitnami/python:latest
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "Platform: $BUILDPLATFORM"
RUN echo "Target: $TARGETPLATFORM"
ENV PYENV_ROOT=/root/.pyenv
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH:/usr/local/bin"
RUN apt-get update && apt-get -o "Acquire::https::Verify-Peer=false" install -y curl ca-certificates git bash pipenv pipx
COPY ./trusted_certs.pem /usr/share/ca-certificates/trusted_certs.crt
COPY ./trusted_certs.pem /usr/local/share/ca-certificates/trusted_certs.crt
RUN echo "trusted_certs.crt" >> /etc/ca-certificates.conf
RUN update-ca-certificates
RUN curl https://pyenv.run | bash && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
RUN pyenv install -s 3.11.0
RUN pyenv local 3.11.0
ENTRYPOINT [ "python3", "script.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment