Install pythonnet in a docker container used for Flask Application

Viewed 236

I am trying to install pythonnet on a docker image - although I keep running into the following problem. Is anyone able to advise the correct methodology:

''' Cloning into 'pythonnet'... Traceback (most recent call last): File "pythonnet/setup.py", line 196, in with open("README.rst", "r") as f: FileNotFoundError: [Errno 2] No such file or directory: 'README.rst' '''

Dockerfile:

FROM python:3.7-slim

# install FreeTDS and dependencies
RUN apt-get update 
RUN pip install --upgrade pip setuptools 
RUN pip install --upgrade wheel

# [ Mono: 5.20.1 ]

RUN 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.1/. main" > /etc/apt/sources.list.d/mono-official.list \
&& apt-get update \
&& apt-get install -y git \
&& apt-get install -y clang \
&& apt-get install -y mono-complete=5.20.1\* \
&& rm -rf /var/lib/apt/lists/* /tmp/*

# [ pythonnet 2.4.0 ]
RUN pip install pycparser
RUN git clone https://github.com/pythonnet/pythonnet \
&& python pythonnet/setup.py bdist_wheel \
&& pip install --no-index --find-links=./pythonnet/dist/ pythonnet

EXPOSE 5000

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt

WORKDIR /app
COPY . /app

# Switching to a non-root user, please refer to https://aka.ms/vscode-docker-python-user-rights
RUN useradd appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]

docker-compose

version: "3.4"

services:
  backend:
    image: backend

    build:
      context: .
      dockerfile: ./Dockerfile

    ports:
      - 5000:5000

    env_file: .env
0 Answers
Related