-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
92 lines (71 loc) · 3.27 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
FROM debian:buster as builder
ARG VERSION=1.14.0
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install build-essential git default-jdk-headless dh-systemd gradle python3-all
RUN git clone https://github.com/LINBIT/linstor-server.git /linstor-server
WORKDIR /linstor-server
RUN git checkout v${VERSION}
RUN make debrelease \
&& rm -rf /root/.gradle/caches/ \
&& mv linstor-server-${VERSION}.tar.gz /linstor-server_${VERSION}.orig.tar.gz \
&& tar -C / -xvf /linstor-server_${VERSION}.orig.tar.gz
WORKDIR /linstor-server-${VERSION}
RUN dpkg-buildpackage -us -uc
# ------------------------------------------------------------------------------
FROM debian:buster as client-builder
ARG API_VERSION=1.9.0
ARG CLIENT_VERSION=1.9.0
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install build-essential debhelper git python3-all python3-setuptools help2man bash-completion docbook-xsl xsltproc
RUN git clone --recurse-submodules https://github.com/LINBIT/linstor-api-py /linstor-api-py
WORKDIR /linstor-api-py
RUN git checkout v${API_VERSION} \
&& make debrelease \
&& mv ./dist/python-linstor-${API_VERSION}.tar.gz ../python-linstor_${API_VERSION}.orig.tar.gz \
&& tar -C / -xvf /python-linstor_${API_VERSION}.orig.tar.gz
WORKDIR /python-linstor-${API_VERSION}
RUN dpkg-buildpackage -us -uc
RUN rm -rf /linstor-api-py \
&& mv /python-linstor-${API_VERSION} /linstor-api-py
RUN git clone https://github.com/LINBIT/linstor-client.git /linstor-client
WORKDIR /linstor-client
RUN git checkout v${CLIENT_VERSION} \
&& make debrelease \
&& mv dist/linstor-client-${CLIENT_VERSION}.tar.gz /linstor-client_${CLIENT_VERSION}.orig.tar.gz \
&& tar -C / -xvf /linstor-client_${CLIENT_VERSION}.orig.tar.gz
WORKDIR /linstor-client-${CLIENT_VERSION}
RUN dpkg-buildpackage -us -uc
# ------------------------------------------------------------------------------
FROM golang:1.15 as k8s-await-election-builder
RUN git clone https://github.com/LINBIT/k8s-await-election/ /usr/local/go/k8s-await-election/ \
&& cd /usr/local/go/k8s-await-election \
&& git reset --hard v0.2.4 \
&& make \
&& mv ./out/k8s-await-election-amd64 /k8s-await-election
# ------------------------------------------------------------------------------
FROM debian:buster
COPY --from=builder /linstor-common_*_all.deb /linstor-controller_*_all.deb /packages/
COPY --from=client-builder /python-linstor_*_all.deb /linstor-client_*_all.deb /packages/
COPY --from=k8s-await-election-builder /k8s-await-election /k8s-await-election
# Install repos and system upgrade
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update \
&& apt-get -y upgrade \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install linstor-controller
RUN apt-get update \
&& apt-get install -y default-jre-headless python3-all python3-natsort \
&& dpkg -i packages/*.deb \
&& sed -i "s|'$| \"-Djdk.tls.acknowledgeCloseNotify=true\"'|" \
/usr/share/linstor-server/bin/Controller \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /config /logs \
&& /usr/share/linstor-server/bin/linstor-config create-db-file \
/data/linstordb > /config/linstor.toml
ENTRYPOINT [ "/usr/share/linstor-server/bin/Controller", "--logs=/logs", "--config-directory=/config" ]