-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Added support for Docker Build/Compose and K8S #16737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| .venv | ||
| .che__/ | ||
| *.log | ||
| *.git | ||
| *.gitignore | ||
| docker | ||
| models/* | ||
| embeddings/* | ||
| extensions/* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM python:3.10 | ||
|
|
||
| WORKDIR /webui | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install ffmpeg libsm6 libxext6 dos2unix google-perftools -y | ||
|
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is also suggested to add |
||
|
|
||
| COPY . . | ||
|
|
||
| RUN dos2unix ./webui.sh ./webui-user.sh | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? I don't see the |
||
|
|
||
| RUN groupadd --system --gid 1000 webui && \ | ||
| useradd webui --uid 1000 --gid 1000 --create-home --shell /bin/bash && \ | ||
| chown -R webui:webui . | ||
| USER 1000:1000 | ||
|
|
||
| RUN ./webui.sh --exit --skip-torch-cuda-test | ||
|
|
||
| CMD [ "./webui.sh", "--skip-prepare-environment", "--listen" ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| services: | ||
| webui: | ||
| build: . | ||
| volumes: | ||
| - type: bind | ||
| source: ./models | ||
| target: /webui/models | ||
| - type: bind | ||
| source: ./outputs | ||
| target: /webui/outputs | ||
| - type: bind | ||
| source: ./extensions | ||
| target: /webui/extensions | ||
| - type: bind | ||
| source: ./embeddings | ||
| target: /webui/embeddings | ||
| - type: bind | ||
| source: ./configs | ||
| target: /webui/configs | ||
| ports: | ||
| - 7860:7860 | ||
| deploy: | ||
| resources: | ||
| reservations: | ||
| devices: | ||
| - driver: nvidia | ||
| count: all | ||
| capabilities: [gpu] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: stable-diffusion-webui | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: stable-diffusion-webui | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: stable-diffusion-webui | ||
| spec: | ||
| containers: | ||
| - name: stable-diffusion-webui | ||
| image: $(YOUR-IMAGE-NAME) # the image name specified when doing `docker build` | ||
| ports: | ||
| - containerPort: 7860 | ||
| volumeMounts: | ||
| - mountPath: /webui/models | ||
| name: models-volume | ||
| - mountPath: /webui/outputs | ||
| name: image-outputs | ||
| - mountPath: /webui/extensions | ||
| name: extensions-volume | ||
| - mountPath: /webui/embeddings | ||
| name: embeddings-volume | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 # Adjust according to your needs | ||
| readinessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 7860 | ||
| initialDelaySeconds: 120 | ||
| periodSeconds: 30 | ||
| volumes: | ||
| - name: models-volume | ||
| hostPath: | ||
| path: $(YOUR-LOCAL-PATH)/models # absolute path of pre-download model on the host machine | ||
| - name: image-outputs | ||
| hostPath: | ||
| path: $(YOUR-LOCAL-PATH)/outputs | ||
| - name: extensions-volume | ||
| hostPath: | ||
| path: $(YOUR-LOCAL-PATH)/extensions # absolute path of extensions | ||
| - name: embeddings-volume | ||
| hostPath: | ||
| path: $(YOUR-LOCAL-PATH)/embeddings # absolute path of pre-download embeddings | ||
|
|
||
|
|
||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: stable-diffusion-webui-service | ||
| spec: | ||
| type: NodePort # You can change this to LoadBalancer if needed | ||
| ports: | ||
| - port: 7860 | ||
| targetPort: 7860 | ||
| selector: | ||
| app: stable-diffusion-webui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
outputs/*is missing from here.