diff --git a/.gitignore b/.gitignore index cf06b4524..78ebc3414 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ __pycache__ submit-biosimulators-container.sh .vagrant ._vagrant +.THIS-IS-FOR-CONTAINER-DEV-ONLY diff --git a/README.md b/README.md index 2d8c740aa..fd8dbd31b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ There are two primary methods of interaction with `biosimulator-processes`: 3. Run the image, ensuring that the running of the container is platform-agnostic: - docker run --platform linux/amd64 -it -p 8888:8888 ghcr.io/biosimulators/biosimulator-processes:latest + docker run --platform linux/amd64 -it -p 8888:8888 ghcr.io/biosimulators/biosimulator-processes:latest As an alternative, there is a helper script that does this and more. To use this script: diff --git a/main.ipynb b/builder/main.ipynb similarity index 100% rename from main.ipynb rename to builder/main.ipynb diff --git a/poetry.lock b/poetry.lock index e1b04c761..075b07576 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4515,4 +4515,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.10" -content-hash = "8b52839909eb18add4e66ecff926d3f738bacb68f02043a7eab698c0072dc341" +content-hash = "780c0143114975709aa119547fd82225963301641c4c735249e973021b03bec5" diff --git a/pyproject.toml b/pyproject.toml index 2ce9cd04c..5fd65049e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ cobra = "*" tellurium = "*" smoldyn = "*" bigraph-viz = "^0.0.31" +python-libsbml = "^5.20.2" [tool.poetry.group.dev.dependencies] pytest = "*" diff --git a/scripts/build-container.sh b/scripts/build-container.sh new file mode 100644 index 000000000..95550d051 --- /dev/null +++ b/scripts/build-container.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +version="$1" + +set -e + +if [ "${version}" == "" ]; then + echo "Please enter the version you would like to build as a runtime arg. Exiting." + exit 1 +fi + +yes | docker system prune +docker buildx create --name biosimbuilder --use +docker buildx inspect --bootstrap +docker buildx build --platform linux/amd64 \ + -t ghcr.io/biosimulators/biosimulator-processes:"${version}" . diff --git a/scripts/docker-pipeline.sh b/scripts/docker-pipeline.sh new file mode 100755 index 000000000..a65834267 --- /dev/null +++ b/scripts/docker-pipeline.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +version="$1" + +run="$2" + +if [ "${version}" == "" ]; then + echo "You must pass the container version you wish to run as an argument to this script. Exiting." + exit 1 +fi + + +if [ "${version}" == "${current}" ]; then + echo "This version already exists on GHCR. Exiting." + exit 1 +fi + +echo "Enter your Github User-Name: " +read -r usr_name + +if docker login ghcr.io -u "${usr_name}"; then + echo "Successfully logged in to GHCR!" +else + echo "Could not validate credentials." + exit 1 +fi + +./scripts/build-container.sh "${version}" \ + && ./scripts/release-container.sh "${version}" \ + +if [ "${run}" == "-r" ]; then + ./scripts/run-container.sh "${version}" +fi diff --git a/scripts/release-container.sh b/scripts/release-container.sh new file mode 100644 index 000000000..209380223 --- /dev/null +++ b/scripts/release-container.sh @@ -0,0 +1,38 @@ +#!/bin/bash + + +version="$1" + +# PLEASE UPDATE THE LATEST VERSION HERE BEFORE RUNNING. CURRENT: 0.0.2 +current="0.0.2" + +set -e + +if [ "${version}" == "" ]; then + echo "You must pass the container version you wish to release as an argument to this script. Exiting." + exit 1 +fi + +if [ "${version}" == "${current}" ]; then + echo "This version already exists on GHCR. Exiting." + exit 1 +fi + +echo "Enter your Github User-Name: " +read -r usr_name + +if docker login ghcr.io -u "${usr_name}"; then + echo "Successfully logged in to GHCR!" +else + echo "Could not validate credentials." + exit 1 +fi + +yes | docker system prune +docker buildx create --name biosimbuilder --use +docker buildx inspect --bootstrap +docker buildx build --platform linux/amd64 \ + -t ghcr.io/biosimulators/biosimulator-processes:"${version}" . \ + --push +docker tag ghcr.io/biosimulators/biosimulator-processes:"${version}" ghcr.io/biosimulators/biosimulator-processes:latest +docker push ghcr.io/biosimulators/biosimulator-processes:latest diff --git a/scripts/run-container.sh b/scripts/run-container.sh new file mode 100755 index 000000000..5671aace3 --- /dev/null +++ b/scripts/run-container.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +version="$1" + +if [ "${version}" == "" ]; then + echo "Please enter the version you would like to run as a runtime arg. Exiting." + exit 1 +fi + +docker run --platform linux/amd64 -it -p 8888:8888 ghcr.io/biosimulators/biosimulator-processes:"${version}" diff --git a/scripts/run-docker.sh b/scripts/run-docker.sh deleted file mode 100755 index ca0207d73..000000000 --- a/scripts/run-docker.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -echo "Push container to GHCR after building? (y/N): " -read -r push - -echo "Run container after building? (y/N): " -read -r run_after - -if [ "${push}" == 'y' ]; then - echo "Enter your Github User-Name: " - read -r usr_name - - if docker login ghcr.io -u "${usr_name}"; then - echo "Successfully logged in to GHCR!" - else - echo "Could not validate credentials." - exit 1 - fi -fi - -yes | docker system prune -docker buildx create --name biosimbuilder --use -docker buildx inspect --bootstrap - -if [ "${push}" == 'y' ]; then - docker buildx build --platform linux/amd64 \ - -t ghcr.io/biosimulators/biosimulator-processes:0.0.1 . \ - --push -else - docker buildx build --platform linux/amd64 -t ghcr.io/biosimulators/biosimulator-processes:0.0.1 . -fi - - -if [ "${run_after}" == 'y' ]; then - docker run --platform linux/amd64 -it -p 8888:8888 ghcr.io/biosimulators/biosimulator-processes:0.0.1 -fi