# Use a base image with Conda installed | |
FROM continuumio/miniconda3 | |
# Install the missing library | |
RUN apt-get update && apt-get install -y libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* | |
# Set the working directory in the container | |
WORKDIR /usr/src/app | |
# Copy the environment.yaml file to the container | |
COPY environment.yaml ./ | |
# Create the Conda environment from the environment.yaml file | |
RUN conda env create -f environment.yaml && conda clean -afy | |
# Activate the environment | |
SHELL ["conda", "run", "-n", "fooocus", "/bin/bash", "-c"] | |
# Copy the rest of your application's code | |
COPY . . | |
# Install any additional dependencies specified in requirements.txt | |
# Note: This is only necessary if you have additional pip packages not listed in environment.yaml | |
RUN conda run -n fooocus pip3 install -r requirements_versions.txt | |
# Make port 80 available to the world outside this container | |
EXPOSE 80 | |
# Define environment variable (if needed) | |
ENV NAME World | |
# Provide access to outputs and models | |
RUN mkdir -p /usr/src/app/outputs && chmod -R 777 /usr/src/app | |
# Run your application | |
CMD ["conda", "run", "-n", "fooocus", "python3", "./entry_with_update.py", "--preset", "realistic"] |