I have Dockerfile to build image for Django project that uses Python 3.11 and runs in poetry environment (see content below). Problem is when I try to donwload get-pip.py
file and run it using Python, it says no such file or directory but it should be in the same directory where Dockerfile is. I don't know, but why isn't it there?
P.S. I use docker desktop with WSL 2 (Ubuntu 20.04) and Dockerfile is in project directory (where poetry.lock
and pyproject.toml
files are), /website
is directory where django project is.
# Download image of Ubuntu 20.04
FROM ubuntu:20.04
# To prevent interactive dialogs
ENV TZ=Europe \
DEBIAN_FRONTEND=noninteractive
# Update and install necessary packages
RUN apt-get update \
# Install necessary packages to allow compilation of source code
&& apt-get install -y --no-install-recommends \
tzdata \
build-essential \
checkinstall \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
tk-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
software-properties-common \
# Install python 3.11
&& apt-get update \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get install -y --no-install-recommends \
python3.11
# Install pip for Python 3.11
RUN curl -sS -O https://bootstrap.pypa.io/get-pip.py | python3.11
# THERE'S AN ERROR
RUN python3.11 get-pip.py
# Install poetry
ENV POETRY_VERSION 1.4.2
RUN python3.11 -m pip install "poetry==$POETRY_VERSION"
# Install dependencies
RUN poetry install
# Run poetry env
ENTRYPOINT ["poetry", "shell"]
# Go to website folder
WORKDIR /website
# Run Django server
CMD ["python3.11", "manage.py", "runserver"]