Skip to content

Commit 50fbb42

Browse files
provide stitch cli via docker (#152)
1 parent cf8f3e7 commit 50fbb42

5 files changed

Lines changed: 80 additions & 1 deletion

File tree

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ignore everything
2+
*
3+
4+
# But not these files...
5+
!README.md
6+
!stitching/
7+
!pyproject.toml
8+
!setup.cfg
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registry:
9+
name: Push Docker image to Docker Hub
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v4
14+
15+
- name: Log in to Docker Hub
16+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
21+
- name: Extract metadata (tags, labels) for Docker
22+
id: meta
23+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
24+
with:
25+
images: openstitching/stitch
26+
27+
- name: Build and push Docker image
28+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
push: true
33+
tags: ${{ steps.meta.outputs.tags }}, latest
34+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM python:3.11
2+
3+
RUN mkdir /stitching
4+
COPY . /stitching
5+
6+
# build and install stitching package
7+
WORKDIR /stitching
8+
RUN pip install build
9+
# we use opencv headless within docker, otherwise we get errors
10+
RUN sed -i 's/opencv-python/opencv-python-headless/g' setup.cfg
11+
RUN python -m build
12+
RUN pip install ./dist/stitching-*.whl
13+
14+
# compile largestinteriorrectangle (JIT)
15+
RUN python -c "import largestinteriorrectangle"
16+
17+
# provide the entrypoint, users need to mount a volume to /data
18+
WORKDIR /data
19+
ENTRYPOINT ["stitch"]
20+
CMD ["-h"]

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pip install stitching
2323

2424
## Usage
2525

26+
### Python CLI
27+
2628
The command line interface
2729
([cli](https://github.com/lukasalexanderweber/stitching/tree/main/stitching/cli/stitch.py))
2830
is available after installation
@@ -41,6 +43,21 @@ Enable verbose mode with `stitch * -v`.
4143
This will create a folder where all intermediate results are stored so that
4244
you can find out where there are problems with your images, if any
4345

46+
### Docker CLI
47+
48+
If you are familiar with Docker and don't feel like
49+
setting up Python and an environment, you can also use the
50+
[openstitching/stitch](https://hub.docker.com/r/openstitching/stitch)
51+
Docker image
52+
53+
`docker container run --rm -v
54+
/path/to/data:/data openstitching/stitch:{version} -h`
55+
56+
You can use the CLI as described above
57+
(read "current directory" as "/data directory")
58+
59+
### Python Script
60+
4461
You can also use the Stitcher class in your script
4562

4663
```python

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ long_description_content_type = text/markdown
77
author = Lukas Weber
88
author_email = l.a.weber@outlook.de
99
license = Apache License 2.0
10-
license_file = LICENSE
10+
license_files = LICENSE
1111
platforms = any
1212
classifiers =
1313
Programming Language :: Python :: 3 :: Only

0 commit comments

Comments
 (0)