diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 33a0f416..00000000 --- a/docker/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# Docker Images - -The Docker commands in this section will propagate user permissions under Unix systems. -If you want to run with default Docker permissions (root), i.e. in a cloud environment, -you can omit the `--user` option. - -## MDIO User - -### Build Docker Image from Scratch - -To run the developer container build first by (from source directory): - -```shell -DOCKER_BUILDKIT=1 docker build -f docker/slim-bullseye-3.10.Dockerfile -t mdio . -``` - -The command above will build the **MDIO** image and tag is as `mdio:latest`. -After this, the examples below can be executed. - -### Examples - -See [CLI documentation](https://mdio-python.readthedocs.io/en/stable/usage.html) for other options. - -#### SEG-Y Ingestion - -Host directory `$HOST_PATH` will be mounted to the container and file `seismic.segy` will -be ingested as `seismic.mdio` with index byte locations `inline=189` and `crossline=193` -using default chunks. - -```shell -docker run --rm --user $(id -u):$(id -g) -v $HOST_PATH:$CONTAINER_PATH mdio segy import -i $CONTAINER_PATH/seismic.segy -o $CONTAINER_PATH/seismic.mdio -loc 181,185 -names inline,crossline -``` - -#### SEG-Y Export - -Host directory `$HOST_PATH` is mounted to the container and file `seismic.mdio` will be exported -as `seismic.segy`. - -```shell -docker run --rm --user $(id -u):$(id -g) -v $HOST_PATH:$CONTAINER_PATH mdio segy export -i $CONTAINER_PATH/seismic.mdio -o $CONTAINER_PATH/seismic.segy -``` - -## MDIO Developer - -### Build Docker Image from Scratch - -To run the developer container build first by (from source directory): - -```shell -DOCKER_BUILDKIT=1 docker build -f docker/slim-bullseye-3.10-dev.Dockerfile -t mdio-dev . -``` - -The command above will build the dev environment image and tag is as `mdio-dev:latest`. - -### Start Container Instance - -Then you can run the container in the background like below. This will ensure the following: - -1. Host UNIX user is propagated, including home directory. -2. Host networking will be used. - -```shell -docker run \ - --name mdio_dev_noroot \ - --tty \ - --detach \ - --network host \ - --user $(id -u):$(id -g) \ - -e USER=$USER \ - -e HOME=$HOME \ - -v $HOME:$HOME \ - -v $SRC_DIR:/mdio-python \ - mdio-dev -``` - -Where `SRC_DIR` environment variable is the path to MDIO source code on host. - -If you want to run with default Docker permissions (root), i.e. in a cloud -environment, you can omit the `--user` option, environment variables `{USER, HOME}` -and the volume mount `HOME`. - -Now you can: - -- Use the container as a remote interpreter. -- Run MDIO developer tools like tests, build docs, etc. - -> **NOTE**: -> MDIO doesn't have to be installed here. As long as `$SRC_DIR` from host is mounted to -> `/mdio-python` in the container, the `PYTHONPATH` variable will let the development -> environment interpreter know where to find MDIO. - -### Running Developer Tools - -Since the container now has developer tools, they can be executed with this pattern: - -```shell -docker exec -it $CONTAINER_NAME $COMMAND -``` - -The `it` flags make the command interactive. - -#### Examples - -##### Linting - -Run linting tools like `black` and `isort`. - -```shell -docker exec -it mdio_dev_noroot black src -docker exec -it mdio_dev_noroot isort src -``` - -##### CI/CD Tools - -Run some CI/CD like pre-commit, testing or building documentation. -The `-rs` flag in `nox` tells it to run a session by reusing an existing virtual env. - -```shell -docker exec -it mdio_dev_noroot nox -rs pre-commit # Run pre-commit CI/CD -docker exec -it mdio_dev_noroot nox -rs tests # Run tests -docker exec -it mdio_dev_noroot nox -rs docs-build # Build docs locally -``` - -##### Jupyter Lab Server - -This should launch a Jupyter Lab server that points to source directory at port 8888. - -```shell -docker exec -it mdio_dev_noroot jupyter lab --ip $HOST_IP --no-browser -``` - -You can kill the server with `Control-C`. - -The `$HOST_IP` can be omitted if docker is running locally. If you are -logged into another server via SSH, `$HOST_IP` must be provided or the -port has to be forwarded explicitly. diff --git a/docker/slim-bullseye-3.10-dev.Dockerfile b/docker/slim-bullseye-3.10-dev.Dockerfile deleted file mode 100644 index 1f59388a..00000000 --- a/docker/slim-bullseye-3.10-dev.Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -# Make venv and install MDIO dependencies -FROM python:3.10-slim-bullseye as venv_base - -# Build time args for dev tools etc -ARG POETRY_VERSION=1.2.2 -ARG NOX_VERSION=2022.11.21 -ARG NOX_POETRY_VERSION=1.0.2 - -ENV PYTHONFAULTHANDLER=1 \ - PYTHONUNBUFFERED=1 - -ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \ - PIP_NO_CACHE_DIR=1 \ - PIP_ROOT_USER_ACTION=ignore - -RUN python -m venv /opt/venv -ENV PATH="/opt/venv/bin:$PATH" - -COPY pyproject.toml poetry.lock / - -RUN pip install \ - "poetry==$POETRY_VERSION" \ - "nox==$NOX_VERSION" \ - "nox-poetry==$NOX_POETRY_VERSION" \ - && poetry config virtualenvs.create false \ - && poetry install \ - --no-root \ - --with dev \ - --with interactive \ - --all-extras \ - --no-ansi - -# Install Git -FROM python:3.10-slim-bullseye as system_tools - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - git \ - graphviz \ - && rm -rf /var/lib/apt/lists/* - -# Final Stage (git + venv) -FROM system_tools - -ENV PYTHONFAULTHANDLER=1 \ - PYTHONUNBUFFERED=1 \ - PIP_NO_CACHE_DIR=1 \ - PATH="/opt/venv/bin:$PATH" \ - SHELL=/bin/bash \ - PYTHONPATH=/mdio-python/src - -COPY --from=venv_base --chmod=777 /opt/venv /opt/venv - -WORKDIR /mdio-python diff --git a/docker/slim-bullseye-3.10.Dockerfile b/docker/slim-bullseye-3.10.Dockerfile deleted file mode 100644 index 71cb22bb..00000000 --- a/docker/slim-bullseye-3.10.Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.10-slim-bullseye - -ARG MDIO_VERSION=0.2.5 - -ENV PYTHONFAULTHANDLER=1 \ - PYTHONUNBUFFERED=1 \ - PIP_DISABLE_PIP_VERSION_CHECK=1 \ - PIP_NO_CACHE_DIR=1 \ - SHELL=/bin/bash \ - NUMBA_CACHE_DIR=/tmp - -RUN pip install "multidimio[lossy,distributed,cloud]==$MDIO_VERSION" - -ENTRYPOINT ["mdio"]