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