Open danstarns opened 1 year ago
I imagine this would help windows users too:
Here are the two I have tried:
# Start with the official PyTorch image
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
# Set the working directory
WORKDIR /app
# Install necessary packages
RUN apt-get update && apt-get install -y \
ffmpeg \
libsm6 \
libxext6 \
libfontconfig1 \
libxrender1 \
&& rm -rf /var/lib/apt/lists/*
# Copy files to the working directory
COPY visual_chatgpt.py requirement.txt download.sh ./
# Create a new environment and install dependencies
RUN conda create -n visgpt python=3.8 && \
echo "conda activate visgpt" >> ~/.bashrc && \
/bin/bash -c "source ~/.bashrc" && \
pip install --no-cache-dir -r requirement.txt && \
bash download.sh && \
conda clean --all --yes && \
rm -rf /opt/conda/pkgs/*
# Set an environment variable for the OpenAI API key
ENV OPENAI_API_KEY=${OPENAI_API_KEY}
# Create a new directory for the generated images
RUN mkdir /app/image && chmod 777 /app/image
# Start the application
CMD ["bash", "-c", "python visual_chatgpt.py"]
FROM python:3.8-slim-buster
WORKDIR /app
COPY visual_chatgpt.py requirement.txt download.sh ./
RUN apt-get update && \
apt-get install -y git && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirement.txt && \
bash download.sh && \
apt-get remove -y git && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV OPENAI_API_KEY=${OPENAI_API_KEY}
RUN mkdir /app/image && chmod 777 /app/image
CMD ["bash", "-c", "python visual_chatgpt.py"]
do they work? why two docker files?
Also the download.sh should be optional because its like 40GB of download. better bind the folder and maybe let users copy models manually or link them or whatever.
Do these dockerfiles work on windows? i havent tried it.
@andzejsp I think that @danstarns wanted to try both pip
and conda
environments. That's why he's provided two Dockerfiles.
Why don't you try it by yourself on Windows?
Just to add my 2 cents, I am still testing it though. Tried resolving the OpenCV version issue https://github.com/microsoft/visual-chatgpt/issues/50.
FROM python:3.8-slim-buster
ENV OPENAI_API_KEY=${OPENAI_API_KEY}
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
RUN apt-get update -y
RUN apt-get install -y git curl wget
RUN git clone https://github.com/microsoft/visual-chatgpt.git
WORKDIR /visual-chatgpt/
RUN pip install --upgrade pip
RUN pip install opencv-python
RUN sed '/opencv/d' requirement.txt > requirement.txt
RUN pip install -r requirement.txt
RUN bash download.sh
RUN mkdir /visual-chatgpt/image && chmod 777 /visual-chatgpt/image
CMD ["bash", "-c", "python", "visual_chatgpt.py"]
Anyone managed to run the newest version in docker?
Please could you add a docker file for this project? I have been trying to add one but having issues related to: