Skip to content

Commit bd592d8

Browse files
authored
Merge pull request #1782 from GRIDAPPSD/releases/2024.06.0
Release of version 2024.06.0
2 parents 147b394 + c931616 commit bd592d8

File tree

13 files changed

+712
-432
lines changed

13 files changed

+712
-432
lines changed

Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GRIDAPPSD_BASE_VERSION=:master
1+
ARG GRIDAPPSD_BASE_VERSION=:develop
22
FROM gridappsd/gridappsd_base${GRIDAPPSD_BASE_VERSION}
33

44
ARG TIMESTAMP
@@ -78,6 +78,18 @@ RUN mkdir ${TEMP_DIR} \
7878
&& cp /gridappsd/services/gridappsd-toolbox/dynamic-ybus/gridappsd-dynamic-ybus-service.config /gridappsd/services/ \
7979
&& cd \
8080
&& rm -rf ${TEMP_DIR}
81+
82+
# Get the gridapspd-distributed-ybus-service from the proper repository
83+
RUN mkdir ${TEMP_DIR} \
84+
&& cd ${TEMP_DIR} \
85+
&& git clone https://github.com/GRIDAPPSD/gridappsd-distributed-static-ybus-service.git -b main \
86+
&& cd gridappsd-distributed-static-ybus-service \
87+
&& mkdir -p /gridappsd/services/gridappsd-distributed-static-ybus-service \
88+
&& rm .git -rf \
89+
&& cp -r * /gridappsd/services/gridappsd-distributed-static-ybus-service \
90+
&& cp /gridappsd/services/gridappsd-distributed-static-ybus-service/gridappsd-distributed-static-ybus-service.config /gridappsd/services/ \
91+
&& cd \
92+
&& rm -rf ${TEMP_DIR}
8193

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

114-
RUN pip install -r /gridappsd/requirements.txt && \
126+
RUN pip install --pre -r /gridappsd/requirements.txt && \
115127
pip install -r /gridappsd/services/fncsgossbridge/requirements.txt && \
116128
rm -rf /root/.cache/pip/wheels
117129

build-gridappsd-container

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,67 @@
1-
docker pull gridappsd/gridappsd_base:master
1+
#!/usr/bin/env python3
22

3-
./gradlew clean
4-
rm -rf gov.pnnl.goss/gridappsd/generated
5-
./gradlew export
3+
"""
4+
Script for building the gridappsd container.
65
7-
docker build --no-cache --network=host -t gridappsd:local .
6+
This script pulls the gridappsd_base docker image, cleans the project, exports the project, and builds the gridappsd container.
7+
8+
Usage:
9+
python build-gridappsd-container <base_version> [--output_version <output_version>]
10+
11+
Arguments:
12+
base_version (str): The version of the gridappsd_base docker image.
13+
output_version (str, optional): The output tag version for local development. Default is "local".
14+
15+
Example:
16+
python build-gridappsd-container.py 2.3.0 --output_version 2.3.1
17+
18+
"""
19+
20+
import argparse
21+
import subprocess
22+
import shutil
23+
24+
25+
def execute(cmd: str | list[str]):
26+
"""
27+
Executes a command in the shell and prints the output.
28+
29+
Args:
30+
cmd (str | list[str]): The command to execute. If a string, it will be split into a list of arguments.
31+
32+
Raises:
33+
subprocess.CalledProcessError: If the command returns a non-zero exit code.
34+
35+
"""
36+
if isinstance(cmd, str):
37+
cmd = cmd.split(" ")
38+
39+
with subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True) as p:
40+
for line in iter(p.stdout.readline, ""):
41+
if line.strip():
42+
print(line.strip())
43+
44+
p.wait()
45+
if p.returncode:
46+
raise subprocess.CalledProcessError(p.returncode, cmd=" ".join(cmd))
47+
48+
49+
50+
if __name__ == '__main__':
51+
52+
parser = argparse.ArgumentParser()
53+
54+
parser.add_argument("base_version",
55+
help="The gridappsd_base docker image version")
56+
parser.add_argument("--output_version", default="local",
57+
help="The output tag version for local development")
58+
59+
opts = parser.parse_args()
60+
61+
base_version = opts.base_version
62+
63+
execute(f"docker pull gridappsd/gridappsd_base:{opts.base_version}")
64+
execute("./gradlew clean")
65+
shutil.rmtree("gov.pnnl.goss/gridappsd/generated", ignore_errors=True)
66+
execute("./gradlew export")
67+
execute(f"docker build --build-arg GRIDAPPSD_BASE_VERSION=:{opts.base_version} --no-cache --network=host -t gridappsd:{opts.output_version} .")

entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ if [ "$1" = "gridappsd" ]; then
1111
sudo pip install -q --disable-pip-version-check -r $reqfile
1212
done
1313

14-
# Run tail -f /dev/null to keep the container running and waiting for connection
15-
echo "[Entrypoint] Waiting for connection"
16-
tail -f /dev/null
14+
15+
if [ "${AUTOSTART:-0}" != "0" ]; then
16+
/gridappsd/run-gridappsd.sh
17+
else
18+
# Run tail -f /dev/null to keep the container running and waiting for connection
19+
echo "[Entrypoint] Waiting for connection"
20+
tail -f /dev/null
21+
fi
1722
elif [ "$1" = "version" -o "$1" = "-v" -o "$1" = "--version" ]; then
1823
echo -n "version: "
1924
cat /gridappsd/dockerbuildversion.txt

0 commit comments

Comments
 (0)