I have a python 3.6 application that I have installed locally using pip install . and a setup.py file. I've tested it locally, and the next step is to move it to a docker container. I'm using the standard python3.6 base image from docker hub, and running the container on a windows 10 host machine. I have the following dockerfile:
FROM python:3.6
WORKDIR /opt
# create a virtual environment and add it to PATH so that it is
# applied for all future RUN and CMD calls
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install Mono for pythonnet.
RUN apt-get update \
&& apt-get install --yes \
apt-transport-https \
git \
dirmngr \
clang \
gnupg \
ca-certificates \
# Dependency for pyodbc.
unixodbc-dev \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-
keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
&& echo "deb http://download.mono-project.com/repo/debian
stretch/snapshots/5.20 main" | tee /etc/apt/sources.list.d/mono-
official-stable.list \
&& apt-get update \
&& apt-get install --yes \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
COPY src ./src
COPY setup.py ./setup.py
COPY config.json ./config.json
COPY Utility.dll ./Utility.dll
COPY settings.ini ./settings.ini
COPY redis_conf.json ./redis_conf.json
COPY sql_config.json ./sql_config.json
RUN python3 -m venv $VIRTUAL_ENV \
# From here on, use virtual env's python.
&& pip install --upgrade pip \
&& pip install --no-cache-dir --upgrade pip setuptools wheel \
&& pip install --no-cache-dir -r requirements.txt \
# Dependency for pythonnet.
&& python -m pip install --no-cache-dir pycparser \
&& python -m pip install -U pythonnet \
&& python setup.py install
The build goes fine, with no errors in the output, but then when I inspect the file system in the container I see that the pythonnet and pycparser are not in the venv/bin/lib directory, or anywhere else. There is an egg-info file in the root directory, but no sign of the installed application. Where am I going wrong here?