forked from LINBIT/linstor-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.controller
93 lines (68 loc) · 3.41 KB
/
Dockerfile.controller
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
FROM centos:centos7 as builder
ENV LINSTOR_VERSION 1.11.1
ENV LINSTOR_TGZNAME linstor-server
ENV LINSTOR_TGZ ${LINSTOR_TGZNAME}-${LINSTOR_VERSION}.tar.gz
USER root
RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical
RUN groupadd makepkg # !lbbuild
RUN useradd -m -g makepkg makepkg # !lbbuild
RUN yum install -y sudo # !lbbuild
RUN usermod -a -G wheel makepkg # !lbbuild
RUN yum install -y rpm-build wget unzip which make git java-1.8.0-openjdk-devel && yum clean all -y # !lbbuild
RUN rpm -e --nodeps fakesystemd && yum install -y systemd && yum clean all -y || true # !lbbuild
RUN mkdir -p /tmp/linstor-$LINSTOR_VERSION
# one can not comment COPY
RUN cd /tmp && wget https://www.linbit.com/downloads/linstor/$LINSTOR_TGZ # !lbbuild
# =lbbuild COPY /${LINSTOR_TGZ} /tmp/
# =lbbuild COPY /pkgcache/* /tmp/pkgcache/
# link gradle to gradle-wrapper
RUN ln -s /home/makepkg/${LINSTOR_TGZNAME}-${LINSTOR_VERSION}/gradlew /usr/local/bin/gradle # !lbbuild
USER makepkg
RUN cd ${HOME} && \
cp /tmp/${LINSTOR_TGZ} ${HOME} && \
mkdir -p ${HOME}/rpmbuild/SOURCES && \
mkdir -p ${HOME}/rpmbuild/RPMS/noarch && \
cp /tmp/${LINSTOR_TGZ} ${HOME}/rpmbuild/SOURCES && \
tar xvf ${LINSTOR_TGZ}
RUN cd ${HOME}/${LINSTOR_TGZNAME}-${LINSTOR_VERSION} && ./gradlew wrapper -PversionOverride= # !lbbuild
RUN cd ${HOME}/${LINSTOR_TGZNAME}-${LINSTOR_VERSION} && \
( cp /tmp/pkgcache/linstor-common*.rpm ${HOME}/rpmbuild/RPMS/noarch/ && \
cp /tmp/pkgcache/linstor-controller*.rpm ${HOME}/rpmbuild/RPMS/noarch/ \
) || rpmbuild -bb --define "debug_package %{nil}" linstor.spec
FROM registry.access.redhat.com/ubi7/ubi
MAINTAINER Roland Kammerer <[email protected]>
# ENV can not be shared between builder and "main"
ENV LINSTOR_VERSION 1.11.1
ARG release=1
LABEL name="linstor-controller" \
vendor="LINBIT" \
version="$LINSTOR_VERSION" \
release="$release" \
summary="LINSTOR's controller component" \
description="LINSTOR's controller component"
COPY COPYING /licenses/gpl-3.0.txt
ENV PSK=https://packages.linbit.com/package-signing-pubkey.asc
ENV REPO=/etc/yum.repos.d/linbit.repo
RUN curl "$PSK" >/tmp/psk.asc && rpm --import /tmp/psk.asc && rm /tmp/psk.asc && \
printf '[linstor-client]\nname=Linstor Client - $basearch \
\nbaseurl=http://packages.linbit.com/public/yum/rhel7/misc/$basearch \
\nenabled=1\ngpgcheck=1\ngpgkey=%s\n' "$PSK" | tee "$REPO"
COPY --from=builder /home/makepkg/rpmbuild/RPMS/noarch/*.rpm /tmp/
RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical && \
yum install -y which && \
yum install -y linstor-client /tmp/linstor-common*.rpm /tmp/linstor-controller*.rpm && \
rm /tmp/*.rpm && yum clean all -y
ARG ARCH=amd64
ARG K8S_AWAIT_ELECTION_VERSION=v0.2.2
RUN curl --fail --location "https://github.com/LINBIT/k8s-await-election/releases/download/${K8S_AWAIT_ELECTION_VERSION}/k8s-await-election-${K8S_AWAIT_ELECTION_VERSION}-linux-${ARCH}.tar.gz" | tar -xvz -C /usr/local/bin/
RUN groupadd linstor
RUN useradd -m -g linstor linstor
RUN mkdir /var/log/linstor-controller
RUN chown -R root:linstor /etc/linstor /var/lib/linstor /var/log/linstor-controller
RUN chmod g+w /etc/linstor /var/lib/linstor /var/log/linstor-controller
EXPOSE 3376/tcp 3377/tcp 3370/tcp 3371/tcp
COPY scripts/entry.sh /
ENV LC_ALL=en_US.utf8
USER linstor
CMD ["startController"]
ENTRYPOINT ["/usr/local/bin/k8s-await-election", "/entry.sh"]