diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c35aa5b69..a6bc46eda 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "ms-python.python", "mhutchie.git-graph" ], - "image": "openspacecollective/open-space-toolkit-astrodynamics-development:latest-debian", + "image": "openspacecollective/open-space-toolkit-astrodynamics-development:latest", "settings": { "terminal.integrated.shell.linux": "/bin/bash" }, diff --git a/Makefile b/Makefile index e2f6d8305..35ffc2c32 100644 --- a/Makefile +++ b/Makefile @@ -30,63 +30,39 @@ pull: ## Pull all images @ echo "Pulling images..." - @ make pull-development-images + @ make pull-development-image @ make pull-release-images -pull-development-images: ## Pull development images +pull-development-image: ## Pull development image - @ echo "Pulling development images..." + @ echo "Pulling development image..." - @ make pull-development-image-debian - @ make pull-development-image-fedora - -pull-development-image-debian: target := debian -pull-development-image-fedora: target := fedora - -pull-development-image-debian pull-development-image-fedora: _pull-development-image - -_pull-development-image: - - @ echo "Pulling [$(target)] development image..." - - docker pull $(docker_development_image_repository):$(docker_image_version)-$(target) || true - docker pull $(docker_development_image_repository):latest-$(target) || true + docker pull $(docker_development_image_repository):$(docker_image_version) || true + docker pull $(docker_development_image_repository):latest || true pull-release-images: ## Pull release images @ echo "Pull release images..." - @ make pull-release-image-cpp-debian - @ make pull-release-image-cpp-fedora + @ make pull-release-image-cpp - @ make pull-release-image-python-debian - @ make pull-release-image-python-fedora + @ make pull-release-image-python @ make pull-release-image-jupyter -pull-release-image-cpp-debian: target := debian -pull-release-image-cpp-fedora: target := fedora - -pull-release-image-cpp-debian pull-release-image-cpp-fedora: _pull-release-image-cpp - -_pull-release-image-cpp: - - @ echo "Pull [$(target)] C++ release image..." - - docker pull $(docker_release_image_cpp_repository):$(docker_image_version)-$(target) || true - docker pull $(docker_release_image_cpp_repository):latest-$(target) || true +pull-release-image-cpp: -pull-release-image-python-debian: target := debian -pull-release-image-python-fedora: target := fedora + @ echo "Pull C++ release image..." -pull-release-image-python-debian pull-release-image-python-fedora: _pull-release-image-python + docker pull $(docker_release_image_cpp_repository):$(docker_image_version) || true + docker pull $(docker_release_image_cpp_repository):latest || true -_pull-release-image-python: _pull-development-image +pull-release-image-python: - @ echo "Pulling [$(target)] Python release image..." + @ echo "Pulling Python release image..." - docker pull $(docker_release_image_python_repository):$(docker_image_version)-$(target) || true - docker pull $(docker_release_image_python_repository):latest-$(target) || true + docker pull $(docker_release_image_python_repository):$(docker_image_version) || true + docker pull $(docker_release_image_python_repository):latest || true pull-release-image-jupyter: @@ -103,30 +79,18 @@ build-images: ## Build development and release images @ echo "Building images..." - @ make build-development-images + @ make build-development-image @ make build-release-images -build-development-images: ## Build development images +build-development-image: pull-development-image ## Build development image - @ echo "Building development images..." - - @ make build-development-image-debian - @ make build-development-image-fedora - -build-development-image-debian: target := debian -build-development-image-fedora: target := fedora - -build-development-image-debian build-development-image-fedora: _build-development-image - -_build-development-image: _pull-development-image - - @ echo "Building [$(target)] development image..." + @ echo "Building development image..." docker build \ - --cache-from=$(docker_development_image_repository):latest-$(target) \ - --file="$(CURDIR)/docker/development/$(target)/Dockerfile" \ - --tag=$(docker_development_image_repository):$(docker_image_version)-$(target) \ - --tag=$(docker_development_image_repository):latest-$(target) \ + --cache-from=$(docker_development_image_repository):latest \ + --file="$(CURDIR)/docker/development/Dockerfile" \ + --tag=$(docker_development_image_repository):$(docker_image_version) \ + --tag=$(docker_development_image_repository):latest \ --build-arg="VERSION=$(docker_image_version)" \ "$(CURDIR)" @@ -134,46 +98,34 @@ build-release-images: ## Build release images @ echo "Building release images..." - @ make build-release-image-cpp-debian - @ make build-release-image-cpp-fedora + @ make build-release-image-cpp - @ make build-release-image-python-debian - @ make build-release-image-python-fedora + @ make build-release-image-python @ make build-release-image-jupyter -build-release-image-cpp-debian: target := debian -build-release-image-cpp-fedora: target := fedora - -build-release-image-cpp-debian build-release-image-cpp-fedora: _build-release-image-cpp +build-release-image-cpp: build-development-image pull-release-image-cpp -_build-release-image-cpp: _build-development-image _pull-release-image-cpp - - @ echo "Building [$(target)] C++ release image..." + @ echo "Building C++ release image..." docker build \ - --cache-from=$(docker_release_image_cpp_repository):latest-$(target) \ - --file="$(CURDIR)/docker/release/$(target)/Dockerfile" \ - --tag=$(docker_release_image_cpp_repository):$(docker_image_version)-$(target) \ - --tag=$(docker_release_image_cpp_repository):latest-$(target) \ + --cache-from=$(docker_release_image_cpp_repository):latest \ + --file="$(CURDIR)/docker/release/Dockerfile" \ + --tag=$(docker_release_image_cpp_repository):$(docker_image_version) \ + --tag=$(docker_release_image_cpp_repository):latest \ --build-arg="VERSION=$(docker_image_version)" \ --target=cpp-release \ "$(CURDIR)" -build-release-image-python-debian: target := debian -build-release-image-python-fedora: target := fedora - -build-release-image-python-debian build-release-image-python-fedora: _build-release-image-python +build-release-image-python: build-development-image pull-release-image-python -_build-release-image-python: _build-development-image _pull-release-image-python - - @ echo "Building [$(target)] Python release image..." + @ echo "Building Python release image..." docker build \ - --cache-from=$(docker_release_image_python_repository):latest-$(target) \ - --file="$(CURDIR)/docker/release/$(target)/Dockerfile" \ - --tag=$(docker_release_image_python_repository):$(docker_image_version)-$(target) \ - --tag=$(docker_release_image_python_repository):latest-$(target) \ + --cache-from=$(docker_release_image_python_repository):latest \ + --file="$(CURDIR)/docker/release/Dockerfile" \ + --tag=$(docker_release_image_python_repository):$(docker_image_version) \ + --tag=$(docker_release_image_python_repository):latest \ --build-arg="VERSION=$(docker_image_version)" \ --target=python-release \ "$(CURDIR)" @@ -190,18 +142,16 @@ build-release-image-jupyter: pull-release-image-jupyter --build-arg="JUPYTER_NOTEBOOK_IMAGE_REPOSITORY=$(jupyter_notebook_image_repository)" \ "$(CURDIR)/docker/jupyter" -build-documentation: target := debian - -build-documentation: _build-development-image ## Build documentation +build-documentation: build-development-image ## Build documentation - @ echo "Building [$(target)] documentation..." + @ echo "Building documentation..." docker run \ --rm \ --volume="$(CURDIR):/app:delegated" \ --volume="/app/build" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_DOCUMENTATION=ON .. \ && make docs" @@ -212,60 +162,31 @@ build-packages: ## Build packages @ make build-packages-cpp @ make build-packages-python -build-packages-cpp: ## Build C++ packages +build-packages-cpp: build-development-image ## Build C++ packages @ echo "Building C++ packages..." - @ make build-packages-cpp-debian - @ make build-packages-cpp-fedora - -build-packages-cpp-debian: target := debian -build-packages-cpp-fedora: target := fedora - -build-packages-cpp-debian: package_generator := DEB -build-packages-cpp-fedora: package_generator := RPM - -build-packages-cpp-debian: package_extension := deb -build-packages-cpp-fedora: package_extension := rpm - -build-packages-cpp-debian build-packages-cpp-fedora: _build-packages-cpp - -_build-packages-cpp: _build-development-image - - @ echo "Building [$(target)] C++ packages..." - docker run \ --rm \ --volume="$(CURDIR):/app:delegated" \ --volume="/app/build" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ - /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=$(package_generator) .. \ + $(docker_development_image_repository):$(docker_image_version) \ + /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=OFF -DCPACK_GENERATOR=DEB .. \ && make package \ && mkdir -p /app/packages/cpp \ - && mv /app/build/*.$(package_extension) /app/packages/cpp" + && mv /app/build/*.deb /app/packages/cpp" -build-packages-python: ## Build Python packages +build-packages-python: build-development-image ## Build Python packages @ echo "Building Python packages..." - @ make build-packages-python-debian - -build-packages-python-debian: target := debian -build-packages-python-fedora: target := fedora - -build-packages-python-debian build-packages-python-fedora: _build-packages-python - -_build-packages-python: _build-development-image - - @ echo "Building [$(target)] Python packages..." - docker run \ --rm \ --volume="$(CURDIR):/app:delegated" \ --volume="/app/build" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -c "cmake -DBUILD_UNIT_TESTS=OFF -DBUILD_PYTHON_BINDINGS=ON .. \ && make -j 4 \ && mkdir -p /app/packages/python \ @@ -273,23 +194,10 @@ _build-packages-python: _build-development-image ################################################################################################################################################################ -start-development: ## Start development environment +start-development-no-link: build-development-image ## Start development environment @ echo "Starting development environment..." - make start-development-debian - -start-development-debian: target := debian -start-development-fedora: target := fedora - -start-development-debian start-development-fedora: _start-development - -_start-development: _build-development-image - -_start-development-no-link: - - @ echo "Starting [$(target)] development environment..." - docker run \ -it \ --rm \ @@ -297,40 +205,31 @@ _start-development-no-link: --volume="$(CURDIR):/app:delegated" \ --volume="$(CURDIR)/tools/development/helpers:/app/build/helpers:ro,delegated" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -_start-development-link: +start-development-link: ## Start linked development environment - @ echo "Starting [$(target)] development environment (linked)..." + $(if $(links), , $(error "You need to provide the links to the C++ dependency repositories you want to link with, separated by white spaces. For example: make start-development-link links="/home/OSTk/open-space-toolkit-io /home/OSTk/open-space-toolkit-core")) - @ target=$(target) "$(CURDIR)/tools/development/start.sh" --link + @ echo "Starting development environment (linked)..." + + @ project_directory="$(CURDIR)" docker_development_image_repository=$(docker_development_image_repository) docker_image_version=$(docker_image_version) "$(CURDIR)/tools/development/start.sh" --link $(links) ifndef link -_start-development: _start-development-no-link +start-development: start-development-no-link else -_start-development: _start-development-link +start-development: start-development-link endif -start-python: ## Start Python runtime environment +start-python: build-release-image-python ## Start Python runtime environment @ echo "Starting Python runtime environment..." - @ make start-python-debian - -start-python-debian: target := debian -start-python-fedora: target := fedora - -start-python-debian start-python-fedora: _start-python - -_start-python: _build-release-image-python - - @ echo "Starting [$(target)] Python runtime environment..." - docker run \ -it \ --rm \ - $(docker_release_image_python_repository):$(docker_image_version)-$(target) + $(docker_release_image_python_repository):$(docker_image_version) start-jupyter-notebook: build-release-image-jupyter ## Starting Jupyter Notebook environment @@ -343,7 +242,7 @@ start-jupyter-notebook: build-release-image-jupyter ## Starting Jupyter Notebook --volume="$(CURDIR)/bindings/python/docs:/home/jovyan/docs" \ --workdir="/home/jovyan" \ $(docker_release_image_jupyter_repository):$(docker_image_version) \ - bash -c "start-notebook.sh --NotebookApp.token=''" + bash -c "start-notebook.sh --ServerApp.token=''" debug-jupyter-notebook: build-release-image-jupyter @@ -359,60 +258,39 @@ debug-jupyter-notebook: build-release-image-jupyter --volume="$(CURDIR)/lib/$(jupyter_project_name_python_shared_object).so:/opt/conda/lib/python$(jupyter_python_version)/site-packages/ostk/$(project_name)/$(jupyter_project_name_python_shared_object).so:ro" \ --workdir="/home/jovyan" \ $(docker_release_image_jupyter_repository):$(docker_image_version) \ - bash -c "start-notebook.sh --NotebookApp.token=''" + bash -c "start-notebook.sh --ServerApp.token=''" ################################################################################################################################################################ -debug-development: +debug-development: build-development-image ## Debug development environment @ echo "Debugging development environment..." - make debug-development-debian - -debug-development-debian: target := debian -debug-development-fedora: target := fedora - -debug-development-debian debug-development-fedora: _debug-development - -_debug-development: _build-development-image - - @ echo "Debugging [$(target)] development environment..." - docker run \ -it \ --rm \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -debug-cpp-release-debian: target := debian -debug-cpp-release-fedora: target := fedora - -debug-cpp-release-debian debug-cpp-release-fedora: _debug-cpp-release +debug-cpp-release: build-release-image-cpp ## Debug C++ release environment -_debug-cpp-release: _build-release-image-cpp - - @ echo "Debugging [$(target)] C++ release environment..." + @ echo "Debugging C++ release environment..." docker run \ -it \ --rm \ --entrypoint=/bin/bash \ - $(docker_release_image_cpp_repository):$(docker_image_version)-$(target) - -debug-python-release-debian: target := debian -debug-python-release-fedora: target := fedora + $(docker_release_image_cpp_repository):$(docker_image_version) -debug-python-release-debian debug-python-release-fedora: _debug-python-release +debug-python-release: build-release-image-python ## Debug Python release environment -_debug-python-release: _build-release-image-python - - @ echo "Debugging [$(target)] Python release environment..." + @ echo "Debugging Python release environment..." docker run \ -it \ --rm \ --entrypoint=/bin/bash \ - $(docker_release_image_python_repository):$(docker_image_version)-$(target) + $(docker_release_image_python_repository):$(docker_image_version) ################################################################################################################################################################ @@ -427,55 +305,34 @@ test-unit: ## Run unit tests @ echo "Running unit tests..." - @ make test-unit-debian - -test-unit-debian: - - @ echo "Running [debian] unit tests..." - - @ make test-unit-cpp-debian - @ make test-unit-python-debian - -test-unit-fedora: - - @ echo "Running [fedora] unit tests..." - - @ make test-unit-cpp-fedora - @ make test-unit-python-fedora - -test-unit-cpp-debian: target := debian -test-unit-cpp-fedora: target := fedora - -test-unit-cpp-debian test-unit-cpp-fedora: _test-unit-cpp + @ make test-unit-cpp + @ make test-unit-python -_test-unit-cpp: _build-development-image +test-unit-cpp: build-development-image ## Run C++ unit tests - @ echo "Running [$(target)] C++ unit tests..." + @ echo "Running C++ unit tests..." docker run \ --rm \ --volume="$(CURDIR):/app:delegated" \ + --volume="$(CURDIR)/share/OpenSpaceToolkit:/usr/local/share/OpenSpaceToolkit:delegated" \ --volume="/app/build" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -c "cmake -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_UNIT_TESTS=ON .. \ && make -j 4 \ && make test" -test-unit-python-debian: target := debian -test-unit-python-fedora: target := fedora +test-unit-python: build-release-image-python ## Run Python unit tests -test-unit-python-debian test-unit-python-fedora: _test-unit-python - -_test-unit-python: _build-release-image-python - - @ echo "Running [$(target)] Python unit tests..." + @ echo "Running Python unit tests..." docker run \ --rm \ + --volume="$(CURDIR)/share/OpenSpaceToolkit:/usr/local/share/OpenSpaceToolkit:delegated" \ --workdir=/usr/local/lib/python3.11/site-packages/ostk/$(project_name) \ --entrypoint="" \ - $(docker_release_image_python_repository):$(docker_image_version)-$(target) \ + $(docker_release_image_python_repository):$(docker_image_version) \ /bin/bash -c "pip install pytest && pytest -sv ." test-coverage: ## Run test coverage cpp @@ -484,27 +341,17 @@ test-coverage: ## Run test coverage cpp @ make test-coverage-cpp -test-coverage-cpp: +test-coverage-cpp: build-development-image @ echo "Running C++ coverage tests..." - @ make test-coverage-cpp-debian - -test-coverage-cpp-debian: target := debian -test-coverage-cpp-fedora: target := fedora - -test-coverage-cpp-debian test-coverage-cpp-fedora: _test-coverage-cpp - -_test-coverage-cpp: _build-development-image - - @ echo "Running [$(target)] C++ coverage tests..." - docker run \ --rm \ --volume="$(CURDIR):/app:delegated" \ + --volume="$(CURDIR)/share/OpenSpaceToolkit:/usr/local/share/OpenSpaceToolkit:delegated" \ --volume="/app/build" \ --workdir=/app/build \ - $(docker_development_image_repository):$(docker_image_version)-$(target) \ + $(docker_development_image_repository):$(docker_image_version) \ /bin/bash -c "cmake -DBUILD_UNIT_TESTS=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_CODE_COVERAGE=ON .. \ && make -j 4 \ && make coverage \ @@ -529,27 +376,14 @@ clean: ## Clean ################################################################################################################################################################ -.PHONY: pull pull-development-images pull-development-image-debian pull-development-image-fedora _pull-development-image \ - build build-images \ - build-development-images build-development-image-debian build-development-image-fedora \ - pull-release-images pull-release-image-cpp-debian pull-release-image-cpp-fedora _pull-release-image-cpp \ - pull-release-image-python-debian pull-release-image-python-fedora _pull-release-image-python \ - pull-release-image-jupyter \ - build-release-image-cpp-debian build-release-image-python-debian build-release-image-python-fedora \ - build-release-image-jupyter \ - build-documentation \ - build-packages-cpp build-packages-cpp-debian build-packages-cpp-fedora \ - start-development start-development-debian start-development-fedora \ - start-python start-python-debian start-python-fedora \ - start-jupyter-notebook debug-jupyter-notebook \ - debug-development-debian debug-cpp-release-debian debug-python-release-debian \ - debug-development-fedora debug-cpp-release-fedora debug-python-release-fedora \ - test \ - test-unit test-unit-debian test-unit-fedora \ - test-unit-cpp-debian test-unit-cpp-fedora \ - test-unit-python-debian test-unit-python-fedora \ - test-coverage \ - test-coverage-cpp test-coverage-cpp-debian test-coverage-cpp-fedora \ +.PHONY: pull pull-development-image \ + build build-images build-development-image \ + pull-release-images pull-release-image-cpp pull-release-image-python pull-release-image-jupyter \ + build-release-image-cpp build-release-image-python build-release-image-jupyter \ + build-documentation build-packages-cpp \ + start-development start-python start-jupyter-notebook debug-jupyter-notebook \ + debug-development debug-cpp-release debug-python-release \ + test test-unit test-unit-cpp test-unit-python test-coverage test-coverage-cpp \ clean ################################################################################################################################################################ @@ -558,6 +392,8 @@ help: @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' +export DOCKER_BUILDKIT = 1 + .DEFAULT_GOAL := help ################################################################################################################################################################ diff --git a/README.md b/README.md index 2da7efa49..93b7b6d0c 100644 --- a/README.md +++ b/README.md @@ -88,14 +88,6 @@ After downloading the relevant `.deb` binary packages, install: apt install open-space-toolkit-astrodynamics-*.deb ``` -#### Fedora / CentOS - -After downloading the relevant `.rpm` binary packages, install: - -```shell -dnf install open-space-toolkit-astrodynamics-*.rpm -``` - ### Python Install from [PyPI](https://pypi.org/project/open-space-toolkit-astrodynamics/): diff --git a/docker/development/debian/Dockerfile b/docker/development/Dockerfile similarity index 98% rename from docker/development/debian/Dockerfile rename to docker/development/Dockerfile index 2fc1e4d59..ca168a476 100644 --- a/docker/development/debian/Dockerfile +++ b/docker/development/Dockerfile @@ -1,7 +1,7 @@ ################################################################################################################################################################ # @project Open Space Toolkit ▸ Astrodynamics -# @file docker/development/debian/Dockerfile +# @file docker/development/Dockerfile # @author Lucas Brémond # @license Apache License 2.0 @@ -9,7 +9,7 @@ ARG BASE_IMAGE_VERSION="latest" -FROM docker.io/openspacecollective/open-space-toolkit-base:latest-debian +FROM docker.io/openspacecollective/open-space-toolkit-base:latest LABEL maintainer="lucas@loftorbital.com" diff --git a/docker/development/fedora/Dockerfile b/docker/development/fedora/Dockerfile deleted file mode 100644 index c6925bea2..000000000 --- a/docker/development/fedora/Dockerfile +++ /dev/null @@ -1,149 +0,0 @@ -################################################################################################################################################################ - -# @project Open Space Toolkit ▸ Mathematics -# @file docker/development/fedora/Dockerfile -# @author Lucas Brémond -# @license Apache License 2.0 - -################################################################################################################################################################ - -ARG BASE_IMAGE_VERSION="latest" - -FROM docker.io/openspacecollective/open-space-toolkit-base:latest-fedora - -LABEL maintainer="lucas@loftorbital.com" - -# Dependencies - -## {fmt} - -ARG FMT_VERSION="5.2.0" - -RUN git clone --branch ${FMT_VERSION} --depth 1 https://github.com/fmtlib/fmt.git /tmp/fmt \ - && cd /tmp/fmt \ - && mkdir build \ - && cd build \ - && cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE .. \ - && make --silent -j $(nproc) \ - && make install \ - && rm -rf /tmp/fmt - -## ordered-map - -ARG ORDERED_MAP_VERSION="0.6.0" - -RUN git clone --branch v${ORDERED_MAP_VERSION} --depth 1 https://github.com/Tessil/ordered-map.git /tmp/ordered-map \ - && cd /tmp/ordered-map \ - && cp -r ./include/tsl /usr/local/include \ - && rm -rf /tmp/ordered-map - -## Eigen - -ARG EIGEN_VERSION="3.3.7" - -RUN mkdir /tmp/eigen \ - && cd /tmp/eigen \ - && wget --quiet https://gitlab.com/libeigen/eigen/-/archive/${EIGEN_VERSION}/eigen-${EIGEN_VERSION}.tar.gz \ - && tar -xvf eigen-${EIGEN_VERSION}.tar.gz \ - && cd eigen-${EIGEN_VERSION} \ - && mkdir build \ - && cd build \ - && cmake .. \ - && make install \ - && rm -rf /tmp/eigen - -## SGP4 - -ARG SGP4_VERSION="6a448b4" - -RUN git clone https://github.com/dnwrnr/sgp4.git /tmp/sgp4 \ - && cd /tmp/sgp4 \ - && git checkout ${SGP4_VERSION} \ - && mkdir build \ - && cd build \ - && cmake -DCMAKE_CXX_FLAGS="-fPIC" .. \ - && make -j $(nproc) \ - && mkdir /usr/local/include/sgp4 \ - && cp ../libsgp4/*.h /usr/local/include/sgp4/ \ - && cp libsgp4/*.a /usr/local/lib \ - && rm -rf /tmp/sgp4 - -## NLopt - -ARG NLOPT_VERSION="2.5.0" - -RUN git clone --branch v${NLOPT_VERSION} --depth 1 https://github.com/stevengj/nlopt.git /tmp/nlopt \ - && cd /tmp/nlopt \ - && mkdir build \ - && cd build \ - && cmake -DBUILD_SHARED_LIBS=OFF .. \ - && make \ - && make install \ - && rm -rf /tmp/nlopt - -## Open Space Toolkit ▸ Core - -ARG OSTK_CORE_VERSION="0.5.0" - -RUN mkdir -p /tmp/open-space-toolkit-core \ - && cd /tmp/open-space-toolkit-core \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/${OSTK_CORE_VERSION}/open-space-toolkit-core-${OSTK_CORE_VERSION}-1.x86_64-runtime.rpm \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-core/releases/download/${OSTK_CORE_VERSION}/open-space-toolkit-core-${OSTK_CORE_VERSION}-1.x86_64-devel.rpm \ - && dnf install -y ./*.rpm \ - && rm -rf /tmp/open-space-toolkit-core - -## Open Space Toolkit ▸ IO - -ARG OSTK_IO_VERSION="0.5.0" - -RUN mkdir -p /tmp/open-space-toolkit-io \ - && cd /tmp/open-space-toolkit-io \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-io/releases/download/${OSTK_IO_VERSION}/open-space-toolkit-io-${OSTK_IO_VERSION}-1.x86_64-runtime.rpm \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-io/releases/download/${OSTK_IO_VERSION}/open-space-toolkit-io-${OSTK_IO_VERSION}-1.x86_64-devel.rpm \ - && dnf install -y ./*.rpm \ - && rm -rf /tmp/open-space-toolkit-io - -## Open Space Toolkit ▸ Mathematics - -ARG OSTK_MATHEMATICS_VERSION="0.6.0" - -RUN mkdir -p /tmp/open-space-toolkit-mathematics \ - && cd /tmp/open-space-toolkit-mathematics \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-mathematics/releases/download/${OSTK_MATHEMATICS_VERSION}/open-space-toolkit-mathematics-${OSTK_MATHEMATICS_VERSION}-1.x86_64-runtime.rpm \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-mathematics/releases/download/${OSTK_MATHEMATICS_VERSION}/open-space-toolkit-mathematics-${OSTK_MATHEMATICS_VERSION}-1.x86_64-devel.rpm \ - && dnf install -y ./*.rpm \ - && rm -rf /tmp/open-space-toolkit-mathematics - -## Open Space Toolkit ▸ Physics - -ARG OSTK_PHYSICS_VERSION="0.6.0" - -RUN mkdir -p /tmp/open-space-toolkit-physics \ - && cd /tmp/open-space-toolkit-physics \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-physics/releases/download/${OSTK_PHYSICS_VERSION}/open-space-toolkit-physics-${OSTK_PHYSICS_VERSION}-1.x86_64-runtime.rpm \ - && wget --quiet https://github.com/open-space-collective/open-space-toolkit-physics/releases/download/${OSTK_PHYSICS_VERSION}/open-space-toolkit-physics-${OSTK_PHYSICS_VERSION}-1.x86_64-devel.rpm \ - && dnf install -y ./*.rpm \ - && rm -rf /tmp/open-space-toolkit-physics - -# Install data - -COPY --from=us.gcr.io/loft-orbital-public/software/open-space-toolkit/data:0.3.0 /open-space-toolkit/physics /usr/local/share/OpenSpaceToolkit/Physics - -ENV OSTK_PHYSICS_COORDINATE_FRAME_PROVIDERS_IERS_MANAGER_LOCAL_REPOSITORY "/usr/local/share/OpenSpaceToolkit/Physics/coordinate/frame/providers/iers" -ENV OSTK_PHYSICS_ENVIRONMENT_EPHEMERIDES_SPICE_MANAGER_LOCAL_REPOSITORY "/usr/local/share/OpenSpaceToolkit/Physics/environment/ephemerides/spice" -ENV OSTK_PHYSICS_ENVIRONMENT_GRAVITATIONAL_EARTH_MANAGER_LOCAL_REPOSITORY "/usr/local/share/OpenSpaceToolkit/Physics/environment/gravitational/earth" -ENV OSTK_PHYSICS_ENVIRONMENT_MAGNETIC_EARTH_MANAGER_LOCAL_REPOSITORY "/usr/local/share/OpenSpaceToolkit/Physics/environment/magnetic/earth" - -# Labels - -ARG VERSION - -ENV VERSION ${VERSION} - -LABEL VERSION="${VERSION}" - -# Execution - -CMD ["/bin/bash"] - -################################################################################################################################################################ diff --git a/docker/release/debian/Dockerfile b/docker/release/Dockerfile similarity index 97% rename from docker/release/debian/Dockerfile rename to docker/release/Dockerfile index 02fe549db..60914cb3d 100644 --- a/docker/release/debian/Dockerfile +++ b/docker/release/Dockerfile @@ -1,7 +1,7 @@ ################################################################################################################################################################ # @project Open Space Toolkit ▸ Astrodynamics -# @file docker/release/debian/Dockerfile +# @file docker/release/Dockerfile # @author Lucas Brémond # @license Apache License 2.0 @@ -9,7 +9,7 @@ ARG VERSION -FROM openspacecollective/open-space-toolkit-astrodynamics-development:${VERSION}-debian as cpp-builder +FROM openspacecollective/open-space-toolkit-astrodynamics-development:${VERSION} as cpp-builder RUN mkdir -p /app/bin /app/build /app/lib diff --git a/docker/release/fedora/Dockerfile b/docker/release/fedora/Dockerfile deleted file mode 100644 index a58668493..000000000 --- a/docker/release/fedora/Dockerfile +++ /dev/null @@ -1,82 +0,0 @@ -################################################################################################################################################################ - -# @project Open Space Toolkit ▸ Astrodynamics -# @file docker/release/fedora/Dockerfile -# @author Lucas Brémond -# @license Apache License 2.0 - -################################################################################################################################################################ - -ARG VERSION - -FROM openspacecollective/open-space-toolkit-astrodynamics-development:${VERSION}-fedora as cpp-builder - -RUN mkdir -p /app/bin /app/build /app/lib - -WORKDIR /app/build - -COPY ./bindings /app/bindings -COPY ./docs /app/docs -COPY ./include /app/include -COPY ./share /app/share -COPY ./src /app/src -COPY ./test /app/test -COPY ./thirdparty /app/thirdparty -COPY ./tools /app/tools -COPY CMakeLists.txt /app/CMakeLists.txt -COPY LICENSE /app/LICENSE -COPY README.md /app/README.md -COPY .git /app/.git - -RUN cmake .. \ - && make -j $(nproc) \ - && make install - -################################################################################################################################################################ - -FROM fedora:32 as cpp-release - -ENV LD_LIBRARY_PATH="/usr/local/lib" - -ENV OSTK_PHYSICS_COORDINATE_FRAME_PROVIDERS_IERS_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/coordinate/frame/providers/iers" -ENV OSTK_PHYSICS_ENVIRONMENT_EPHEMERIDES_SPICE_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/ephemerides/spice" -ENV OSTK_PHYSICS_ENVIRONMENT_GRAVITATIONAL_EARTH_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/gravitational/earth" -ENV OSTK_PHYSICS_ENVIRONMENT_MAGNETIC_EARTH_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/magnetic/earth" - -COPY --from=cpp-builder /usr/local/include/OpenSpaceToolkit /usr/local/include/OpenSpaceToolkit -COPY --from=cpp-builder /usr/local/lib/libopen-space-toolkit-astrodynamics.* /usr/local/lib/ -COPY --from=cpp-builder /usr/local/share/OpenSpaceToolkit /usr/local/share/OpenSpaceToolkit -COPY --from=cpp-builder /usr/local/test/OpenSpaceToolkit /usr/local/test/OpenSpaceToolkit - -ENTRYPOINT ["/usr/local/test/OpenSpaceToolkit/Astrodynamics/open-space-toolkit-astrodynamics.test"] - -################################################################################################################################################################ - -FROM fedora:32 as python-builder - -COPY --from=cpp-builder /app/build/bindings/python/dist /dist - -RUN python3.8 -m ensurepip --default-pip \ - && python3.8 -m pip install /dist/*38*.whl - -################################################################################################################################################################ - -FROM fedora:32 as python-release - -LABEL maintainer="lucas@loftorbital.com" - -RUN python3.8 -m ensurepip --default-pip \ - && python3.8 -m pip install ipython numpy - -COPY --from=us.gcr.io/loft-orbital-public/software/open-space-toolkit/data:0.3.0 /open-space-toolkit/physics /usr/local/share/OpenSpaceToolkit/Physics - -ENV OSTK_PHYSICS_COORDINATE_FRAME_PROVIDERS_IERS_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/coordinate/frame/providers/iers" -ENV OSTK_PHYSICS_ENVIRONMENT_EPHEMERIDES_SPICE_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/ephemerides/spice" -ENV OSTK_PHYSICS_ENVIRONMENT_GRAVITATIONAL_EARTH_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/gravitational/earth" -ENV OSTK_PHYSICS_ENVIRONMENT_MAGNETIC_EARTH_MANAGER_LOCAL_REPOSITORY="/usr/local/share/OpenSpaceToolkit/Physics/environment/magnetic/earth" - -COPY --from=python-builder /usr/local/lib/python3.8/site-packages/ostk /usr/local/lib/python3.8/site-packages/ostk - -ENTRYPOINT ["ipython"] - -################################################################################################################################################################ diff --git a/tools/development/start.sh b/tools/development/start.sh index 1e956a41f..6c5f60a8f 100755 --- a/tools/development/start.sh +++ b/tools/development/start.sh @@ -9,83 +9,117 @@ ################################################################################################################################################################ -project_directory=$(git rev-parse --show-toplevel) - -open_space_toolkit_core_directory="${project_directory}/../open-space-toolkit-core" -open_space_toolkit_physics_directory="${project_directory}/../open-space-toolkit-physics" +# Check input arguments if [[ -z ${project_directory} ]]; then echo "Variable [project_directory] is undefined." exit 1 fi -options="" -command="/bin/bash" +if [[ -z ${docker_development_image_repository} ]]; then + echo "Variable [docker_development_image_repository] is undefined." + exit 1 +fi + +if [[ -z ${docker_image_version} ]]; then + echo "Variable [docker_image_version] is undefined." + exit 1 +fi + +project_directory=$(git rev-parse --show-toplevel) + +# Initialize variables + +options=() +command="" # Setup linked mode if [[ ! -z ${1} ]] && [[ ${1} == "--link" ]]; then - options="" - command="" + for link in "${@:2}" + + do + + # Extract last part of the path + + dep=${link##*/} + + # Log the linking step + + echo "Linking with ${dep} at ${link}..." + + # Open Space Toolkit ▸ Core + + if [[ ${dep} == "open-space-toolkit-core" ]]; then + + options+=( "-v" ) + options+=( "${link}:/mnt/open-space-toolkit-core:ro" ) + + command="${command} \ + rm -rf /usr/local/include/OpenSpaceToolkit/Core; \ + rm -f /usr/local/lib/libopen-space-toolkit-core.so*; \ + cp -as /mnt/open-space-toolkit-core/include/OpenSpaceToolkit/Core /usr/local/include/OpenSpaceToolkit/Core; \ + cp -as /mnt/open-space-toolkit-core/src/OpenSpaceToolkit/Core/* /usr/local/include/OpenSpaceToolkit/Core/; \ + ln -s /mnt/open-space-toolkit-core/lib/libopen-space-toolkit-core.so /usr/local/lib/; \ + ln -s /mnt/open-space-toolkit-core/lib/libopen-space-toolkit-core.so.0 /usr/local/lib/;" + + fi - # Open Space Toolkit ▸ Core + # Open Space Toolkit ▸ IO - if [[ -z ${open_space_toolkit_core_directory} ]]; then - echo "Variable [open_space_toolkit_core_directory] is undefined." - exit 1 - fi + if [[ ${dep} == "open-space-toolkit-io" ]]; then - if [[ ! -d ${open_space_toolkit_core_directory} ]]; then - echo "Open Space Toolkit ▸ Core directory [${open_space_toolkit_core_directory}] cannot be found." - exit 1 - fi + options+=( "-v" ) + options+=( "${link}:/mnt/open-space-toolkit-io:ro" ) - options="${options} \ - --volume=${open_space_toolkit_core_directory}:/mnt/open-space-toolkit-core:ro" + command="${command} \ + rm -rf /usr/local/include/OpenSpaceToolkit/IO; \ + rm -f /usr/local/lib/libopen-space-toolkit-io.so*; \ + cp -as /mnt/open-space-toolkit-io/include/OpenSpaceToolkit/IO /usr/local/include/OpenSpaceToolkit/IO; \ + cp -as /mnt/open-space-toolkit-io/src/OpenSpaceToolkit/IO/* /usr/local/include/OpenSpaceToolkit/IO/; \ + ln -s /mnt/open-space-toolkit-io/lib/libopen-space-toolkit-io.so /usr/local/lib/; \ + ln -s /mnt/open-space-toolkit-io/lib/libopen-space-toolkit-io.so.0 /usr/local/lib/;" - command="${command} \ - rm -rf /usr/local/include/OpenSpaceToolkit/Core; \ - rm -f /usr/local/lib/libopen-space-toolkit-core.so*; \ - cp -as /mnt/open-space-toolkit-core/include/OpenSpaceToolkit/Core /usr/local/include/OpenSpaceToolkit/Core; \ - cp -as /mnt/open-space-toolkit-core/src/OpenSpaceToolkit/Core/* /usr/local/include/OpenSpaceToolkit/Core/; \ - ln -s /mnt/open-space-toolkit-core/lib/libopen-space-toolkit-core.so /usr/local/lib/; \ - ln -s /mnt/open-space-toolkit-core/lib/libopen-space-toolkit-core.so.0 /usr/local/lib/;" + fi - # Open Space Toolkit ▸ I/O + # Open Space Toolkit ▸ Mathematics - # TBI + if [[ ${dep} == "open-space-toolkit-mathematics" ]]; then - # Open Space Toolkit ▸ Mathematics + options+=( "-v" ) + options+=( "${link}:/mnt/open-space-toolkit-mathematics:ro" ) - # TBI + command="${command} \ + rm -rf /usr/local/include/OpenSpaceToolkit/Mathematics; \ + rm -f /usr/local/lib/libopen-space-toolkit-mathematics.so*; \ + cp -as /mnt/open-space-toolkit-mathematics/include/OpenSpaceToolkit/Mathematics /usr/local/include/OpenSpaceToolkit/Mathematics; \ + cp -as /mnt/open-space-toolkit-mathematics/src/OpenSpaceToolkit/Mathematics/* /usr/local/include/OpenSpaceToolkit/Mathematics/; \ + ln -s /mnt/open-space-toolkit-mathematics/lib/libopen-space-toolkit-mathematics.so /usr/local/lib/; \ + ln -s /mnt/open-space-toolkit-mathematics/lib/libopen-space-toolkit-mathematics.so.0 /usr/local/lib/;" - # Open Space Toolkit ▸ Physics + fi - if [[ -z ${open_space_toolkit_physics_directory} ]]; then - echo "Variable [open_space_toolkit_physics_directory] is undefined." - exit 1 - fi + # Open Space Toolkit ▸ Physics - if [[ ! -d ${open_space_toolkit_physics_directory} ]]; then - echo "Open Space Toolkit ▸ Physics directory [${open_space_toolkit_physics_directory}] cannot be found." - exit 1 - fi + if [[ ${dep} == "open-space-toolkit-physics" ]]; then - # options="--volume=$(printf %q "${open_space_toolkit_physics_directory}"):/mnt/open-space-toolkit-physics:ro" + options+=( "-v" ) + options+=( "${link}:/mnt/open-space-toolkit-physics:ro" ) + + command="${command} \ + rm -rf /usr/local/include/OpenSpaceToolkit/Physics; \ + rm -f /usr/local/lib/libopen-space-toolkit-physics.so*; \ + cp -as /mnt/open-space-toolkit-physics/include/OpenSpaceToolkit/Physics /usr/local/include/OpenSpaceToolkit/Physics; \ + cp -as /mnt/open-space-toolkit-physics/src/OpenSpaceToolkit/Physics/* /usr/local/include/OpenSpaceToolkit/Physics/; \ + ln -s /mnt/open-space-toolkit-physics/lib/libopen-space-toolkit-physics.so /usr/local/lib/; \ + ln -s /mnt/open-space-toolkit-physics/lib/libopen-space-toolkit-physics.so.0 /usr/local/lib/;" - command="${command} \ - rm -rf /usr/local/include/OpenSpaceToolkit/Physics; \ - rm -f /usr/local/lib/libopen-space-toolkit-physics.so*; \ - cp -as /mnt/open-space-toolkit-physics/include/OpenSpaceToolkit/Physics /usr/local/include/OpenSpaceToolkit/Physics; \ - cp -as /mnt/open-space-toolkit-physics/src/OpenSpaceToolkit/Physics/* /usr/local/include/OpenSpaceToolkit/Physics/; \ - ln -s /mnt/open-space-toolkit-physics/lib/libopen-space-toolkit-physics.so /usr/local/lib/; \ - ln -s /mnt/open-space-toolkit-physics/lib/libopen-space-toolkit-physics.so.0 /usr/local/lib/;" + fi - # Output + done - command="${command} \ - /bin/bash" + command="${command} /bin/bash" fi @@ -95,7 +129,7 @@ docker run \ -it \ --rm \ --privileged \ - ${options} \ + "${options[@]}" \ --volume="${project_directory}:/app:delegated" \ --volume="${project_directory}/tools/development/helpers:/app/build/helpers:ro,delegated" \ --workdir="/app/build" \