Skip to content

Commit 721cb32

Browse files
committed
chore: add sd Dockerfile
1 parent a393beb commit 721cb32

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build*/
2+
test/
3+
4+
.cache/
5+
*.swp
6+
models/

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG UBUNTU_VERSION=22.04
2+
3+
FROM ubuntu:$UBUNTU_VERSION as build
4+
5+
RUN apt-get update && apt-get install -y build-essential git cmake
6+
7+
WORKDIR /sd.cpp
8+
9+
COPY . .
10+
11+
RUN mkdir build && cd build && cmake .. && cmake --build . --config Release
12+
13+
FROM ubuntu:$UBUNTU_VERSION as runtime
14+
15+
COPY --from=build /sd.cpp/build/bin/sd /sd
16+
17+
ENTRYPOINT [ "/sd" ]

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,16 @@ You can specify the output model format using the --out_type parameter
8686

8787
### Build
8888

89+
#### Build from scratch
90+
8991
```shell
9092
mkdir build
9193
cd build
9294
cmake ..
9395
cmake --build . --config Release
9496
```
9597

96-
#### Using OpenBLAS
98+
##### Using OpenBLAS
9799

98100
```
99101
cmake .. -DGGML_OPENBLAS=ON
@@ -151,6 +153,22 @@ Using formats of different precisions will yield results of varying quality.
151153
<img src="./assets/img2img_output.png" width="256x">
152154
</p>
153155
156+
### Docker
157+
158+
#### Building using Docker
159+
160+
```shell
161+
docker build -t sd .
162+
```
163+
164+
#### Run
165+
166+
```shell
167+
docker run -v /path/to/models:/models -v /path/to/output/:/output sd [args...]
168+
# For example
169+
# docker run -v ./models:/models -v ./build:/output sd -m /models/sd-v1-4-ggml-model-f16.bin -p "a lovely cat" -v -o /output/output.png
170+
```
171+
154172
## Memory/Disk Requirements
155173

156174
| precision | f32 | f16 |q8_0 |q5_0 |q5_1 |q4_0 |q4_1 |

0 commit comments

Comments
 (0)