Skip to content

Commit

Permalink
#106 Add gcc11 image for distribution.
Browse files Browse the repository at this point in the history
Signed-off-by: Gautier Bureau <gautier.bureau@rte-france.com>
  • Loading branch information
gautierbureau authored and rosiereflo committed Jul 4, 2024
1 parent 0e31f35 commit 4d1f351
Show file tree
Hide file tree
Showing 10 changed files with 504 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/distribution-gcc11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Distribution gcc11 Image

on:
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses : actions/checkout@v4
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: |
cd Distribution-gcc11
docker build . --file Dockerfile --tag dynawo/dynawo-distribution-gcc11:latest
- name: Docker Push
run: docker push dynawo/dynawo-distribution-gcc11
1 change: 1 addition & 0 deletions Distribution-gcc11/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
72 changes: 72 additions & 0 deletions Distribution-gcc11/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (c) 2024, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of Dynawo, an hybrid C++/Modelica open source time domain simulation tool for power systems.
FROM ubuntu:22.04
LABEL maintainer Gautier Bureau "gautier.bureau@rte-france.com"

ENV TZ=Europe/Paris \
DEBIAN_FRONTEND=noninteractive

RUN apt update \
&& apt upgrade -y -q \
&& apt install -y git \
gcc \
g++ \
gfortran \
autoconf \
pkgconf \
automake \
make \
libtool \
cmake \
hwloc \
openjdk-8-jdk \
libblas-dev \
liblpsolve55-dev \
libarchive-dev \
doxygen \
doxygen-latex \
liblapack-dev \
libexpat1-dev \
libsqlite3-dev \
zlib1g-dev \
gettext \
patch \
clang \
python3-pip \
libncurses5-dev \
libreadline-dev \
libdigest-perl-md5-perl \
unzip \
gcovr \
lcov \
libboost-all-dev \
lsb-release \
libxml2-utils \
python3-lxml \
python3-psutil \
wget \
libcurl4-openssl-dev \
rsync \
libopenblas-openmp-dev \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools \
vim \
curl \
wget \
ninja-build \
gdb \
gdbserver \
sudo \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

CMD ["/bin/bash"]
54 changes: 54 additions & 0 deletions Distribution-gcc11/build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
#
# Copyright (c) 2024, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of Dynawo, an hybrid C++/Modelica open source time domain simulation tool for power systems.
#

source ../Helper/helper.sh

usage() {
echo -e "Usage: `basename $0` [OPTIONS]\tprogram to create a Dynawo image.
where OPTIONS can be one of the following:
--name (-n) myname image name created (default: dynawo-distribution-gcc11)
--help (-h) print this message.
"
}

build_image() {
if ! `image_exists $image_name`; then
docker build --force-rm -t $image_name --no-cache=true .
else
echo "Image $image_name already exists. You can delete it with: ./delete_image.sh --name $image_name"
exit 1
fi
}

image_name=dynawo-distribution-gcc11

while (($#)); do
case "$1" in
--help|-h)
usage
exit 0
;;
--name|-n)
image_name=$2
shift 2
;;
*)
echo "$1: invalid option."
usage
exit 1
;;
esac
done

build_image
59 changes: 59 additions & 0 deletions Distribution-gcc11/connect_to_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
#
# Copyright (c) 2024, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of Dynawo, an hybrid C++/Modelica open source time domain simulation tool for power systems.
#

source ../Helper/helper.sh

usage() {
echo -e "Usage: `basename $0` [OPTIONS]\tprogram to connect to a Dynawo container.
where OPTIONS can be one of the following:
--name (-n) myname container name to connect to (default: dynawo-distribution-gcc11)
--help (-h) print this message.
"
}

connect_to_container() {
if `container_exists $container_name`; then
if ! `container_is_running $container_name`; then
docker start $container_name
fi
docker exec -it $container_name bash
else
echo "You specified a container $container_name that is not created."
echo "List of available containers:"
for name in `docker ps -a --format "{{.Names}}"`; do echo " $name"; done
exit 1
fi
}

container_name=dynawo-distribution-gcc11

while (($#)); do
case "$1" in
--help|-h)
usage
exit 0
;;
--name|-n)
container_name=$2
shift 2
;;
*)
echo "$1: invalid option."
usage
exit 1
;;
esac
done

connect_to_container
62 changes: 62 additions & 0 deletions Distribution-gcc11/connect_to_container_mine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
#
# Copyright (c) 2024, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of Dynawo, an hybrid C++/Modelica open source time domain simulation tool for power systems.
#

source ../Helper/helper.sh

usage() {
echo -e "Usage: `basename $0` [OPTIONS]\tprogram to connect to a Dynawo container.
where OPTIONS can be one of the following:
--name (-n) myname container name to connect to (default: dynawo-distribution)
--help (-h) print this message.
"
}

connect_to_container() {
if `container_exists $container_name`; then
if ! `container_is_running $container_name`; then
docker start $container_name
fi
docker exec -u root $container_name groupadd "$(id -u -n)" -g "$(id -g)"
docker exec -u root $container_name adduser "$(id -u -n)" -u "$(id -u)" -g "$(id -g)"
docker exec -u root $container_name chown -R "$(id -u -n)":"$(id -u -n)" /home/dynawo_distribution/
docker exec -it -u "$(id -u):$(id -g)" $container_name bash
else
echo "You specified a container $container_name that is not created."
echo "List of available containers:"
for name in `docker ps -a --format "{{.Names}}"`; do echo " $name"; done
exit 1
fi
}

container_name=dynawo-distribution

while (($#)); do
case "$1" in
--help|-h)
usage
exit 0
;;
--name|-n)
container_name=$2
shift 2
;;
*)
echo "$1: invalid option."
usage
exit 1
;;
esac
done

connect_to_container
68 changes: 68 additions & 0 deletions Distribution-gcc11/create_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
#
# Copyright (c) 2024, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of Dynawo, an hybrid C++/Modelica open source time domain simulation tool for power systems.
#

source ../Helper/helper.sh

usage() {
echo -e "Usage: `basename $0` [OPTIONS]\tprogram to create a Dynawo container.
where OPTIONS can be one of the following:
--container-name (-n) mycontainer container name created (default: dynawo-distribution-gcc11)
--image-name (-i) myimage image name (default: dynawo-distribution-gcc11)
--help (-h) print this message.
"
}

create_container() {
if ! `container_exists $container_name`; then
if `image_exists $image_name`; then
docker run -it -d --name=$container_name \
$image_name bash
else
echo "You specified an image name that is not existing."
echo "List of available images:"
for name in `docker images --format "{{.Repository}}" | sort | uniq`; do echo " $name"; done
exit 1
fi
else
echo "Container $container_name already exists. You can delete it with: ./delete_container.sh --name $container_name"
exit 1
fi
}

container_name=dynawo-distribution-gcc11
image_name=dynawo-distribution-gcc11

while (($#)); do
case "$1" in
--help|-h)
usage
exit 0
;;
--container-name|-n)
container_name=$2
shift 2
;;
--image-name|-i)
image_name=$2
shift 2
;;
*)
echo "$1: invalid option."
usage
exit 1
;;
esac
done

create_container
Loading

0 comments on commit 4d1f351

Please sign in to comment.