AVSLab / basilisk

Astrodynamics simulation framework
https://hanspeterschaub.info/basilisk
ISC License
149 stars 61 forks source link

Dockerfile for containerized Basilisk #350

Open mikeawalker opened 1 year ago

mikeawalker commented 1 year ago

Describe your use case My team and I use basilisk and deploy it (along with our simulation python scripts) as part of a containerized set of microservices. This allows us to have basilisk talk to other products that run as containers and deploy them very easily both on local computers and in cloud environments. Basilisk has served us extremely well in this way. If the Basilisk team is interested, I'd be happy to open a Pull Request, share our docker file, and setup whatever testing is required. We also use this container as a 'devcontainer' with vs code making it really easy for us to indoctrinate new Basilisk users.

Describe alternatives solutions you've considered We also run basilisk locally. However, to run basilisk as part of a containerized set of services a Dockerfile is required.

Additional context I already have a working docker file and am willing to submit it and do whatever work is required for the Pull Request Thanks for making Basilisk open source. Its great!

ephraim271 commented 1 year ago

Was exploring something similar recently - this would be very helpful!

schaubh commented 1 year ago

Howdy Mike, thanks for sharing. @patkenneally is working on a similar feature to where our future CI build will automatically create docker images of BSK for users to use. If a user only needs to run BSK, not develop new C/C++ modules, this will make it much easier to deploy.

mikeawalker commented 1 year ago

cool! Let me if you want me to contribute. I've got dockerfiles, .devcontainer vscode setup etc that works with the latest release.

GorgiAstro commented 10 months ago

cool! Let me if you want me to contribute. I've got dockerfiles, .devcontainer vscode setup etc that works with the latest release.

Hey Mike, it would be great to see your docker files, I'm also working on containerizing Basilisk in Docker.

GorgiAstro commented 10 months ago

cool! Let me if you want me to contribute. I've got dockerfiles, .devcontainer vscode setup etc that works with the latest release.

Hey Mike, it would be great to see your docker files, I'm also working on containerizing Basilisk in Docker.

Okay actually I used the Dockerfile from this ticket and only had to slightly modify it, it worked :) : https://github.com/AVSLab/basilisk/issues/131

mikeawalker commented 10 months ago

Here is a slightly out of date snippet I have of the Dockerfile.

This is from when bsk was in bitbucket so youd have to change the url. Also I think you need to version fix conan to something lower.

We use this to build bsk plus our custom add ons


FROM ubuntu:focal as builder
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Etc/UTC
RUN apt-get -y update \
    && apt-get upgrade -y \
    && apt-get install -y \
    build-essential \
    # gcc \
    # python \
    python3.8 \
    python3-setuptools \
    python3-tk \
    python3-pip \
    python3-venv \
    python3-dev \
    swig \
    git \
    neovim \
    wget \
    curl \
    && apt-get clean \
    && apt-get autoclean \ 
    && rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /venv
ENV PATH="/venv/bin:${PATH}"
RUN pip3 install --upgrade pip --no-cache && \
    pip3 install wheel --no-cache && \
    pip3 install conan cmake numpy astropy matplotlib pytest pandas Pillow parse --no-cache
ARG BSK_TAG=2.1.3
RUN git clone --depth=1 --branch=${BSK_TAG} https://bitbucket.org/avslab/basilisk.git /bsk/ 
ARG BUILD_TYPE=Debug
WORKDIR /bsk
COPY bsk_custom /bsk_addon/
RUN python3 conanfile.py --pathToExternalModules /bsk_addon --buildType ${BUILD_TYPE} && \
    python3 conanfile.py --pathToExternalModules /bsk_addon --buildType ${BUILD_TYPE} && \
    cd dist3 && \
    if [ "${BUILD_TYPE}" = "Release" ]; then \
        find Basilisk -name "*.so" -type f | xargs strip -S && \
        rm -rf CMakeFiles; \
    fi