Skip to content

Commit c4bbe99

Browse files
Optimize Docker Image Size (#213)
1 parent 4e96e21 commit c4bbe99

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
FROM python:3.11
1+
FROM python:3.11 AS builder
22

3-
RUN mkdir /stitching
4-
COPY . /stitching
5-
6-
# build and install stitching package
73
WORKDIR /stitching
4+
COPY . .
85
RUN pip install build
96
# we use opencv headless within docker, otherwise we get errors
107
RUN sed -i 's/opencv-python/opencv-python-headless/g' setup.cfg
118
RUN python -m build
12-
RUN pip install ./dist/stitching-*.whl
9+
10+
FROM python:3.11-slim
11+
12+
WORKDIR /stitching
13+
COPY --from=builder /stitching/dist/stitching-*.whl .
14+
RUN pip install stitching-*.whl
1315

1416
# compile largestinteriorrectangle (JIT)
1517
RUN python -c "import largestinteriorrectangle"

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ Docker image
5555
`docker container run --rm -v
5656
/path/to/data:/data openstitching/stitch:{version} -h`
5757

58-
You can use the CLI as described above
59-
(read "current directory" as "/data directory")
58+
You can use the Python CLI as described above
59+
(read "current directory" as "/data directory"). NOTE a single `*` wont
60+
work in linux because of the host shell expansion, you must use more
61+
explicit file pattern / file names.
6062

6163
### Python Script
6264

0 commit comments

Comments
 (0)