Skip to content

Commit 1303289

Browse files
small docker improvements (#230)
reduce image size from 650mb to 530mb
1 parent c4bde1b commit 1303289

3 files changed

Lines changed: 13 additions & 19 deletions

File tree

.dockerignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
# Ignore everything
2-
*
3-
4-
# But not these files...
5-
!README.md
6-
!stitching/
7-
!pyproject.toml
8-
!setup.cfg
1+
__pycache__/

Dockerfile

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

33
WORKDIR /stitching
4-
COPY . .
5-
RUN pip install build
6-
# we use opencv headless within docker, otherwise we get errors
7-
RUN sed -i 's/opencv-python/opencv-python-headless/g' setup.cfg
8-
RUN python -m build
4+
5+
COPY setup.cfg pyproject.toml README.md .
6+
COPY stitching/ ./stitching/
7+
8+
RUN pip install --no-cache-dir build && \
9+
sed -i 's/opencv-python/opencv-python-headless/g' setup.cfg && \
10+
python -m build
911

1012
FROM python:3.11-slim
1113

1214
WORKDIR /stitching
1315
COPY --from=builder /stitching/dist/stitching-*.whl .
14-
RUN pip install stitching-*.whl
16+
RUN pip install --no-cache-dir stitching-*.whl && \
17+
rm stitching-*.whl
1518

1619
# compile largestinteriorrectangle (JIT)
1720
RUN python -c "import largestinteriorrectangle"

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ is available after installation
3333

3434
`stitch -h` show the help
3535

36-
`stitch *` stitches all files in the current directory
36+
`stitch *.jpg` stitches all jpg files in the current directory
3737

3838
`stitch img_dir/IMG*.jpg` stitches all files in the img_dir directory
3939
starting with "IMG" and ending with ".jpg"
4040

4141
`stitch img1.jpg img2.jpg img3.jpg`
4242
stitches the 3 explicit files of the current directory
4343

44-
Enable verbose mode with `stitch * -v`.
44+
Enable verbose mode with `stitch *.jpg -v`.
4545
This will create a folder where all intermediate results are stored so that
4646
you can find out where there are problems with your images, if any
4747

@@ -56,9 +56,7 @@ Docker image
5656
/path/to/data:/data openstitching/stitch:{version} -h`
5757

5858
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.
59+
(read "current directory" as "/data directory").
6260

6361
### Python Script
6462

0 commit comments

Comments
 (0)