Skip to content

Commit

Permalink
Fix DOCKERFILE
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklinke committed Oct 12, 2024
1 parent 9aba848 commit a8ea11f
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions compose/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app
ARG DEBIAN_FRONTEND=noninteractive
ARG MULTIPLE_PYTHON # Set to True if you want to use multiple Python versions
ARG PYTHON_3_9=3.9.19
ARG PYTHON_3_10=3.10.14
ARG PYTHON_3_11=3.11.9
ARG PYTHON_3_12=3.12.3
Expand All @@ -26,35 +25,35 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
bash curl wget git make \
build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev ca-certificates

# Install pyenv
# RUN git clone https://github.com/pyenv/pyenv.git .pyenv
# ENV PYENV_ROOT ${APP_HOME}/.pyenv
# ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN git clone https://github.com/pyenv/pyenv.git .pyenv
ENV PYENV_ROOT ${APP_HOME}/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH

# Install Python version(s)
# RUN if [ "$MULTIPLE_PYTHON" = "True" ] ; then \
# pyenv install ${PYTHON_3_12}; \
# pyenv install ${PYTHON_3_11}; \
# pyenv install ${PYTHON_3_10}; \
# pyenv install ${PYTHON_3_9}; \
# else \
# pyenv install 3.12; \
# fi

# # Initialize pyenv
# RUN eval "$(pyenv init -)"
RUN if [ "$MULTIPLE_PYTHON" = "True" ] ; then \
pyenv install ${PYTHON_3_12}; \
pyenv install ${PYTHON_3_11}; \
pyenv install ${PYTHON_3_10}; \
else \
pyenv install 3.12; \
fi

# Initialize pyenv
RUN eval "$(pyenv init -)"

# Add deadsnakes PPA
RUN apt update
RUN apt-get install -y software-properties-common
RUN add-apt-repository 'ppa:deadsnakes/ppa'
RUN apt-get update

# Make Python version(s) accessible in the project and install Python venv
RUN if [ "$MULTIPLE_PYTHON" = "True" ] ; then \
apt-get install -y python3.12-venv python3.9-venv python3.10-venv python3.11-venv; \
pyenv local ${PYTHON_3_12} ${PYTHON_3_9} ${PYTHON_3_10} ${PYTHON_3_11}; \
apt-get install -y python3.12-venv python3.10-venv python3.11-venv; \
pyenv local ${PYTHON_3_12} ${PYTHON_3_10} ${PYTHON_3_11}; \
else \
apt-get install -y python3.12-venv; \
pyenv local 3.12; \
Expand Down Expand Up @@ -88,7 +87,7 @@ COPY ./src/ ${APP_HOME}/
COPY ./src/ ${APP_HOME}/src/

# Rehash pyenv shims
# RUN pyenv rehash
RUN pyenv rehash

# Project initialization:
COPY ./compose/django/entrypoint /entrypoint
Expand Down

0 comments on commit a8ea11f

Please sign in to comment.