Skip to content
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

Updating Docker Entrypoints #47

Merged
merged 4 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Github issue templates (thanks to Scott Staniewicz)
- Tests for the CLI and main python interace tests.
- Minimum for distmetrics to ensure proper target crs is utilized when merging.
- Updated entrypoint for the docker container to allow for CLI arguments to be passed directly to the container.

### Fixed
- Ensures CLI correctly populates `apply_water_mask` and `water_mask_path` arguments.
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ RUN echo "conda activate dist-s1-env" >> ~/.bashrc
# Install repository with pip
RUN python -m pip install --no-cache-dir /home/ops/dist-s1

ENTRYPOINT ["/bin/bash", "-l", "-c"]
CMD ["echo Greetings from OPERA DIST-S1 team"]
ENTRYPOINT ["/home/ops/dist-s1/src/dist_s1/etc/entrypoint.sh"]
CMD ["--help"]
7 changes: 5 additions & 2 deletions Dockerfile.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ RUN echo ". /opt/miniforge/etc/profile.d/conda.sh" >> ~/.bashrc && \
# Install repository with pip
RUN python -m pip install --no-cache-dir /home/ops/dist-s1

ENTRYPOINT ["/bin/bash", "-l", "-c"]
CMD ["echo Greetings from OPERA DIST-S1 team"]
## Allows us to provide CLI arguments to the container
## If interactively jump into the container is desired,
## overwrite the entrypoint with --entrypoint /bin/bash ...
ENTRYPOINT ["/home/ops/dist-s1/src/dist_s1/etc/entrypoint.sh"]
CMD ["--help"]
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,18 @@ docker build -f Dockerfile -t dist-s1-img .
```
On Mac ARM, you can specify the target platform via:
```
docker buildx build --platform linux/amd64 -f Dockerfile -t dist-s1 .
docker buildx build --platform linux/amd64 -f Dockerfile -t dist-s1-img .
```
The docker image will be tagged with `dist-s1-img` in the above examples.

### Generating a Sample Product via a Docker Container

To generate a sample product via a docker container (e.g. the one built above), run:
```
docker run -ti --rm dist-s1-img --mgrs_tile_id '11SLT' --post_date '2025-01-21' --track_number 71
```
See the `src/dist_s1/etc/entrypoint.sh` file for the entrypoint of the container. It runs `dist-s1 run...`.


### GPU Docker Image

Expand All @@ -177,7 +187,7 @@ See issue [#22](https://github.com/opera-adt/dist-s1/issues/22) for more details

To run the container interactively:
```
docker run -ti --rm dist-s1 bash
docker run -ti --rm --entrypoint "/bin/bash" dist-s1-img # assuming the image is tagged as dist-s1-img
```
Within the container, you can run the CLI commands and the test suite.
The `--rm` ensures that the container is removed after we exit the shell.
Expand All @@ -200,8 +210,9 @@ docker pull ghcr.io/opera-adt/dist-s1:0.0.4
The command will pull the latest released version of the Docker image. To run the test suite, run:

```
docker run --rm ghcr.io/opera-adt/dist-s1 'cd dist-s1 && pytest tests'
docker run --rm --entrypoint '/bin/bash' ghcr.io/opera-adt/dist-s1 -c -l 'cd dist-s1 && pytest tests'
```
Note we have to use the `--entrypoint` flag to overwrite the entrypoint of the container which is `python -um dist_s1 run` by default.


# Contribution Instructions
Expand Down
3 changes: 3 additions & 0 deletions src/dist_s1/etc/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash --login
set -e
exec python -um dist_s1 run "$@"