-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathDockerfile-rocky
152 lines (143 loc) · 5.87 KB
/
Dockerfile-rocky
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# syntax=docker/dockerfile:1.2
#################################################################
# #
# Copyright (c) 2019-2024 YottaDB LLC and/or its subsidiaries. #
# All rights reserved. #
# #
# This source code contains the intellectual property #
# of its copyright holder(s), and is made available #
# under a license. If you do not know the terms of #
# the license, please stop and do not read further. #
# #
#################################################################
# See README.md for more information about this Dockerfile
# Simple build/running directions are below:
#
# Build:
# $ docker build -t yottadb/yottadb-rocky:latest-master -f Dockerfile-rocky .
#
# Use with data persistence:
# $ docker run --rm -p 9080-9081:9080-9081 -v `pwd`/ydb-data:/data -ti yottadb/yottadb-rocky:latest-master
# Stage 1: YottaDB build image
FROM rockylinux:8.8 as ydb-release-builder
ARG CMAKE_BUILD_TYPE=Release
RUN yum update -y || true && \
yum install -y \
git \
gcc \
make \
cmake \
tcsh \
gawk \
libconfig \
libicu-devel \
ncurses-devel \
elfutils-libelf-devel \
binutils-devel \
openssl-devel \
libgcrypt-devel \
readline-devel
RUN mkdir /tmp/yottadb-src
ADD CMakeLists.txt /tmp/yottadb-src
# We want to copy the directories themselves, not their contents.
# Unfortunately, there is no way to do this with globs, so we have to specify each directory individually.
# c.f. <https://docs.docker.com/engine/reference/builder/#add>, <https://stackoverflow.com/questions/26504846>
ADD cmake /tmp/yottadb-src/cmake
ADD sr_aarch64 /tmp/yottadb-src/sr_aarch64
ADD sr_armv7l /tmp/yottadb-src/sr_armv7l
ADD sr_i386 /tmp/yottadb-src/sr_i386
ADD sr_linux /tmp/yottadb-src/sr_linux
ADD sr_port /tmp/yottadb-src/sr_port
ADD sr_port_cm /tmp/yottadb-src/sr_port_cm
ADD sr_unix /tmp/yottadb-src/sr_unix
ADD sr_unix_cm /tmp/yottadb-src/sr_unix_cm
ADD sr_unix_gnp /tmp/yottadb-src/sr_unix_gnp
ADD sr_unix_nsb /tmp/yottadb-src/sr_unix_nsb
ADD sr_x86_64 /tmp/yottadb-src/sr_x86_64
ADD sr_x86_regs /tmp/yottadb-src/sr_x86_regs
ADD .git /tmp/yottadb-src/.git
ENV GIT_DIR=/tmp/yottadb-src/.git
RUN mkdir -p /tmp/yottadb-build \
&& cd /tmp/yottadb-build \
&& test -f /tmp/yottadb-src/.yottadb.vsn || \
grep YDB_ZYRELEASE /tmp/yottadb-src/sr_*/release_name.h \
| grep -o '\(r[0-9.]*\)' \
| sort -u \
> /tmp/yottadb-src/.yottadb.vsn \
&& cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/tmp \
-D YDB_INSTALL_DIR:STRING=yottadb-release \
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
/tmp/yottadb-src \
&& make -j `grep -c ^processor /proc/cpuinfo` \
&& make install
# Stage 2: YottaDB GUI install
FROM rockylinux:8.8 as ydb-gui
RUN --mount=type=bind,from=ydb-release-builder,source=/tmp/yottadb-release,target=/tmp/staging \
# This is a strange step: The mount volume is readonly; and we actually write to it in ydbinstall
# So we need to copy the mount contents to a seaprate folder
cp -R /tmp/staging /tmp/ydb-release && \
yum update -y && \
yum install -y \
file \
binutils \
findutils \
elfutils-libelf \
libicu \
wget \
procps-ng \
nano \
gzip \
cmake \
git \
pkg-config \
make \
gcc \
libcurl-devel \
&& \
# Add the CMake build_os_release file which is not part of the install
# directory Needed to allow us to build Rocky Linux on AARCH64 for Docker
# Hub, but it's not officially supported. We do this AFTER yum update, since
# it can change the minor version and cause /etc/os-release and
# /tmp/build_os_release to be different and result in ydbinstall failing.
cp /etc/os-release /tmp/build_os_release && \
/tmp/ydb-release/ydbinstall --utf8 --installdir /opt/yottadb/current --gui
# Stage 3: YottaDB release image
FROM rockylinux:8.8 as ydb-release
RUN --mount=type=bind,from=ydb-release-builder,source=/tmp/yottadb-release,target=/tmp/staging \
--mount=type=bind,from=ydb-gui,source=/opt/yottadb/current/plugin/,target=/tmp/plugin \
# This is a strange step: The mount volume is readonly; and we actually write to it in ydbinstall
# So we need to copy the mount contents to a seaprate folder
cp -R /tmp/staging /tmp/ydb-release && \
yum update -y && \
yum install -y \
file \
binutils \
findutils \
elfutils-libelf \
libicu \
wget \
procps-ng \
nano \
gzip \
nodejs \
&& \
# Add the CMake build_os_release file which is not part of the install
# directory Needed to allow us to build Rocky Linux on AARCH64 for Docker
# Hub, but it's not officially supported. We do this AFTER yum update, since
# it can change the minor version and cause /etc/os-release and
# /tmp/build_os_release to be different and result in ydbinstall failing.
cp /etc/os-release /tmp/build_os_release && \
/tmp/ydb-release/ydbinstall --utf8 --installdir /opt/yottadb/current && \
cp -R /tmp/plugin /opt/yottadb/current/ && \
yum remove -y wget && \
yum clean all && \
rm -rf /var/cache/yum && \
rm -rf /tmp/ydb-release
WORKDIR /data
EXPOSE 9080 9081
COPY ci/docker-scripts/docker-main-startup.sh /docker-main-startup.sh
ENV gtmdir=/data \
LC_ALL=C.UTF-8 \
EDITOR=/usr/bin/nano
ENTRYPOINT ["/docker-main-startup.sh"]