-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
132 lines (94 loc) · 3.86 KB
/
Dockerfile
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
FROM golang:1.22.1-bookworm AS gobuild
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y \
libzmq5-dev \
make \
pkg-config
ADD .git /usr/local/src/ot-sim/.git
ADD src/go /usr/local/src/ot-sim/src/go
RUN make -C /usr/local/src/ot-sim/src/go install
FROM python:3.11-bookworm as pybuild
ADD .git /usr/local/src/ot-sim/.git
ADD src/python /usr/local/src/ot-sim/src/python
RUN python3 -m pip install /usr/local/src/ot-sim/src/python
FROM debian:bookworm AS build
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y \
build-essential \
cmake \
git \
libboost-dev \
libczmq-dev \
libxml2-dev \
libzmq3-dev \
pkg-config \
python3-dev \
python3-pip \
wget
ADD .git /usr/local/src/ot-sim/.git
ADD CMakeLists.txt /usr/local/src/ot-sim/CMakeLists.txt
ADD src/c /usr/local/src/ot-sim/src/c
ADD src/c++ /usr/local/src/ot-sim/src/c++
RUN cmake -S /usr/local/src/ot-sim -B /usr/local/src/ot-sim/build \
&& cmake --build /usr/local/src/ot-sim/build -j $(nproc) --target install
FROM debian:bookworm AS prod
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y \
bash-completion curl git tmux tree vim wget xz-utils \
libczmq4 libsodium23 libxml2 libzmq5 python3-pip
RUN curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg \
| tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null \
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list \
| tee /etc/apt/sources.list.d/tailscale.list \
&& apt update && apt install -y tailscale
WORKDIR /root
ADD install-node-red.sh .
# needed by nod-red install script
ARG TARGETARCH
RUN /root/install-node-red.sh \
&& rm /root/install-node-red.sh
ADD ./src/js/node-red /root/.node-red/nodes/ot-sim
RUN cd /root/.node-red/nodes/ot-sim && npm install && cd /root
COPY --from=gobuild /usr/local /usr/local
COPY --from=pybuild /usr/local /usr/local
COPY --from=build /usr/local /usr/local
RUN ldconfig
WORKDIR /
CMD ["ot-sim-cpu-module", "/etc/ot-sim/config.xml"]
FROM debian:bookworm AS test
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt install -y \
bash-completion curl git mbpoll tmux tree vim wget xz-utils \
build-essential cmake libczmq4 libsodium23 libxml2 libzmq5 python3-dev python3-pip
RUN curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg \
| tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null \
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list \
| tee /etc/apt/sources.list.d/tailscale.list \
&& apt update && apt install -y tailscale
RUN wget -O hivemind.gz https://github.com/DarthSim/hivemind/releases/download/v1.1.0/hivemind-v1.1.0-linux-amd64.gz \
&& gunzip --stdout hivemind.gz > /usr/local/bin/hivemind \
&& chmod +x /usr/local/bin/hivemind \
&& rm hivemind.gz
RUN wget -O overmind.gz https://github.com/DarthSim/overmind/releases/download/v2.2.2/overmind-v2.2.2-linux-amd64.gz \
&& gunzip --stdout overmind.gz > /usr/local/bin/overmind \
&& chmod +x /usr/local/bin/overmind \
&& rm overmind.gz
WORKDIR /root
ADD install-node-red.sh .
# needed by nod-red install script
ARG TARGETARCH
RUN /root/install-node-red.sh \
&& rm /root/install-node-red.sh
ADD ./src/js/node-red /root/.node-red/nodes/ot-sim
RUN cd /root/.node-red/nodes/ot-sim && npm install && cd /root
COPY --from=gobuild /usr/local /usr/local
COPY --from=pybuild /usr/local /usr/local
COPY --from=build /usr/local /usr/local
RUN python3 -m pip install --break-system-packages opendssdirect.py~=0.8.4
RUN ldconfig
ADD . /usr/local/src/ot-sim
WORKDIR /usr/local/src/ot-sim