Skip to content

Commit

Permalink
Merge pull request #1782 from GRIDAPPSD/releases/2024.06.0
Browse files Browse the repository at this point in the history
Release of version 2024.06.0
  • Loading branch information
tonya1 authored Jul 9, 2024
2 parents 147b394 + c931616 commit bd592d8
Show file tree
Hide file tree
Showing 13 changed files with 712 additions and 432 deletions.
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GRIDAPPSD_BASE_VERSION=:master
ARG GRIDAPPSD_BASE_VERSION=:develop
FROM gridappsd/gridappsd_base${GRIDAPPSD_BASE_VERSION}

ARG TIMESTAMP
Expand Down Expand Up @@ -78,6 +78,18 @@ RUN mkdir ${TEMP_DIR} \
&& cp /gridappsd/services/gridappsd-toolbox/dynamic-ybus/gridappsd-dynamic-ybus-service.config /gridappsd/services/ \
&& cd \
&& rm -rf ${TEMP_DIR}

# Get the gridapspd-distributed-ybus-service from the proper repository
RUN mkdir ${TEMP_DIR} \
&& cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-distributed-static-ybus-service.git -b main \
&& cd gridappsd-distributed-static-ybus-service \
&& mkdir -p /gridappsd/services/gridappsd-distributed-static-ybus-service \
&& rm .git -rf \
&& cp -r * /gridappsd/services/gridappsd-distributed-static-ybus-service \
&& cp /gridappsd/services/gridappsd-distributed-static-ybus-service/gridappsd-distributed-static-ybus-service.config /gridappsd/services/ \
&& cd \
&& rm -rf ${TEMP_DIR}

# Copy initial applications and services into the container.
#
Expand Down Expand Up @@ -111,7 +123,7 @@ RUN chmod +x /usr/local/bin/opendsscmd && \
# before executing this script.
COPY ./gov.pnnl.goss.gridappsd/generated/distributions/executable/run.bnd.jar /gridappsd/lib/run.bnd.jar

RUN pip install -r /gridappsd/requirements.txt && \
RUN pip install --pre -r /gridappsd/requirements.txt && \
pip install -r /gridappsd/services/fncsgossbridge/requirements.txt && \
rm -rf /root/.cache/pip/wheels

Expand Down
70 changes: 65 additions & 5 deletions build-gridappsd-container
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
docker pull gridappsd/gridappsd_base:master
#!/usr/bin/env python3

./gradlew clean
rm -rf gov.pnnl.goss/gridappsd/generated
./gradlew export
"""
Script for building the gridappsd container.
docker build --no-cache --network=host -t gridappsd:local .
This script pulls the gridappsd_base docker image, cleans the project, exports the project, and builds the gridappsd container.
Usage:
python build-gridappsd-container <base_version> [--output_version <output_version>]
Arguments:
base_version (str): The version of the gridappsd_base docker image.
output_version (str, optional): The output tag version for local development. Default is "local".
Example:
python build-gridappsd-container.py 2.3.0 --output_version 2.3.1
"""

import argparse
import subprocess
import shutil


def execute(cmd: str | list[str]):
"""
Executes a command in the shell and prints the output.
Args:
cmd (str | list[str]): The command to execute. If a string, it will be split into a list of arguments.
Raises:
subprocess.CalledProcessError: If the command returns a non-zero exit code.
"""
if isinstance(cmd, str):
cmd = cmd.split(" ")

with subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) as p:
for line in iter(p.stdout.readline, ""):
if line.strip():
print(line.strip())

p.wait()
if p.returncode:
raise subprocess.CalledProcessError(p.returncode, cmd=" ".join(cmd))



if __name__ == '__main__':

parser = argparse.ArgumentParser()

parser.add_argument("base_version",
help="The gridappsd_base docker image version")
parser.add_argument("--output_version", default="local",
help="The output tag version for local development")

opts = parser.parse_args()

base_version = opts.base_version

execute(f"docker pull gridappsd/gridappsd_base:{opts.base_version}")
execute("./gradlew clean")
shutil.rmtree("gov.pnnl.goss/gridappsd/generated", ignore_errors=True)
execute("./gradlew export")
execute(f"docker build --build-arg GRIDAPPSD_BASE_VERSION=:{opts.base_version} --no-cache --network=host -t gridappsd:{opts.output_version} .")
11 changes: 8 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ if [ "$1" = "gridappsd" ]; then
sudo pip install -q --disable-pip-version-check -r $reqfile
done

# Run tail -f /dev/null to keep the container running and waiting for connection
echo "[Entrypoint] Waiting for connection"
tail -f /dev/null

if [ "${AUTOSTART:-0}" != "0" ]; then
/gridappsd/run-gridappsd.sh
else
# Run tail -f /dev/null to keep the container running and waiting for connection
echo "[Entrypoint] Waiting for connection"
tail -f /dev/null
fi
elif [ "$1" = "version" -o "$1" = "-v" -o "$1" = "--version" ]; then
echo -n "version: "
cat /gridappsd/dockerbuildversion.txt
Expand Down
Loading

0 comments on commit bd592d8

Please sign in to comment.