-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
86 lines (63 loc) · 2.27 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Makefile for docker that contains Dymola.
#
#
# [email protected] 2019-01-08
###############################################################
# Version, such as 1.22.0-1 (for release) or 1.22.0~dev-41-g8a5b18f-1 (for stable)
# See https://build.openmodelica.org/apt/dists/focal/nightly/binary-amd64/Packages for package version.
#OPENMODELICA_VERSION=1.23.0~dev.beta.1-1-g379f714-1
OPENMODELICA_VERSION=1.24.0-1
# Use stable, nightly or release
#TYPE=stable
TYPE=release
OPENMODELICA_VERSION_NOTILDE=$(subst ~,-,$(OPENMODELICA_VERSION))
TOP_PACKAGE=Buildings
# Top level package name, and location of the library to be tested
BUILDINGS_LIB=~/proj/ldrd/bie/modeling/github/lbl-srg/modelica-buildings
IBPSA_LIB=~/proj/ldrd/bie/modeling/github/ibpsa/modelica-ibpsa
ifeq ($(TOP_PACKAGE), Buildings)
MODELICA_LIB=${BUILDINGS_LIB}
else
MODELICA_LIB=${IBPSA_LIB}
endif
LIB_VERSION=`grep -Po ^version=\".+\" ${MODELICA_LIB}/${TOP_PACKAGE}/package.mo | \
sed -s 's/version=\"//g' | \
sed -s 's/\",//g'`
MO_ROOT=$(shell basename ${MODELICA_LIB})
NAME=lbnlblum/ubuntu-2204-omc:${OPENMODELICA_VERSION_NOTILDE}
#DISPLAY=$(shell echo ${DOCKER_HOST} | sed -e 's|tcp://||' | sed -e 's|:.*||')
UNAME := $(shell uname)
DOCKER_FLAGS=\
--detach=false \
--rm \
--user=developer \
-v ${MODELICA_LIB}:/mnt/modelica_lib \
-v `pwd`/shared:/mnt/shared \
${NAME}
COMMAND_RUN=docker run ${DOCKER_FLAGS} /bin/bash -c
COMMAND_START=docker run -t --interactive ${DOCKER_FLAGS} /bin/bash -c -i
print_version:
@echo ${OPENMODELICA_VERSION_NOTILDE}
start_bash:
$(COMMAND_START) \
"ln -s /mnt/modelica_lib/${TOP_PACKAGE} /home/developer/.openmodelica/libraries/${TOP_PACKAGE}\ ${LIB_VERSION} && \
cd /mnt/shared && bash"
test:
rm -f shared/*
mkdir -p shared
cp test.mos shared/
$(COMMAND_RUN) \
"ln -s /mnt/modelica_lib/${TOP_PACKAGE} /home/developer/.openmodelica/libraries/${TOP_PACKAGE}\ ${LIB_VERSION} && \
cd /mnt/shared && \
omc test.mos"
rm shared/*
remove:
docker rm $(docker ps -a -q)
remove-image:
docker rmi ${NAME}
build:
@echo Building docker image ${NAME}
docker build --build-arg OPENMODELICA_VERSION=${OPENMODELICA_VERSION} --build-arg TYPE=${TYPE} --no-cache -t ${NAME} .
push:
@echo "**** Pushing image ${NAME}"
docker push ${NAME}