File size: 1,783 Bytes
f92590b 0ba2c71 f92590b 0ba2c71 f92590b 8c8ca97 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# Base image with CUDA 12.2
FROM nvidia/cuda:12.2.2-base-ubuntu22.04
# Install pip if not already installed
RUN apt-get update -y && apt-get install -y \
python3-pip \
python3-dev \
git \
build-essential # Install dependencies for building extensions
# Define environment variables for UID and GID and local timezone
ENV PUID=${PUID:-1000}
ENV PGID=${PGID:-1000}
# Create a group with the specified GID
RUN groupadd -g "${PGID}" appuser
# Create a user with the specified UID and GID
RUN useradd -m -s /bin/sh -u "${PUID}" -g "${PGID}" appuser
WORKDIR /app
RUN git clone https://github.com/cocktailpeanut/fluxgym && \
cd fluxgym && \
pip install --no-cache-dir -r ./requirements.txt && \
git clone -b sd3 https://github.com/kohya-ss/sd-scripts && \
cd sd-scripts && \
pip install --no-cache-dir -r ./requirements.txt
# Get sd-scripts from kohya-ss and install them
#RUN git clone -b sd3 https://github.com/kohya-ss/sd-scripts && \
# cd sd-scripts && \
# pip install --no-cache-dir -r ./requirements.txt
# Install main application dependencies
#COPY ./requirements.txt ./requirements.txt
#RUN pip install --no-cache-dir -r ./requirements.txt
# Install Torch, Torchvision, and Torchaudio for CUDA 12.2
RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu122/torch_stable.html
RUN chown -R appuser:appuser /app
RUN pwd
# delete redundant requirements.txt and sd-scripts directory within the container
#RUN cd ..
#RUN rm -r ./sd-scripts
#RUN rm ./requirements.txt
#Run application as non-root
USER appuser
# Copy fluxgym application code
COPY . ./fluxgym
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
WORKDIR /app/fluxgym
# Run fluxgym Python application
CMD ["python3", "./app.py"] |