-
Notifications
You must be signed in to change notification settings - Fork 5
/
Containerfile.ubuntu22.unprivileged
153 lines (140 loc) · 4.32 KB
/
Containerfile.ubuntu22.unprivileged
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
153
###############################################################################
# Copyright 2022, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
FROM ubuntu:22.04 AS base
RUN apt-get update \
&& apt-get install -qq -y --no-install-recommends gpg gpg-agent
# Install required OS tools.
RUN apt-get update \
&& apt-get install -qq -y --no-install-recommends \
software-properties-common \
&& add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt-get install -qq -y --no-install-recommends \
ant \
ant-contrib \
autoconf \
build-essential \
ca-certificates \
cmake \
cpio \
curl \
dumb-init \
file \
g++ \
gcc \
gdb \
git \
libbsd0 \
libnftables1 \
libnl-3-200 \
libnet1 \
libasound2-dev \
libcups2-dev \
libdwarf-dev \
libelf-dev \
libexpat1-dev \
libffi-dev \
libfontconfig \
libfontconfig1-dev \
libfreetype6-dev \
libnuma-dev \
libssl-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxrender-dev \
libxt-dev \
libxtst-dev \
make \
nasm \
openssh-client \
openssh-server \
perl \
pkg-config \
ssh \
systemtap-sdt-dev \
unzip \
wget \
xvfb \
zip \
zlib1g-dev \
libnet1 \
libnl-3-200 \
libnftables1 \
libprotobuf-c1 \
libprotobuf-c-dev \
python3-protobuf \
vim \
&& rm -rf /var/lib/apt/lists/*
# Install prerequisites for CRIU build.
FROM base AS criu-builder
RUN apt-get update \
&& apt-get install -qq -y \
iptables \
libbsd-dev \
libcap-dev \
libnet1-dev \
libgnutls28-dev \
libgnutls30 \
libnftables-dev \
libnl-3-dev \
libprotobuf-dev \
python3-distutils \
protobuf-c-compiler \
protobuf-compiler
# Build CRIU from source.
RUN cd /tmp \
&& git clone https://github.com/ymanton/criu.git \
&& cd criu \
&& git checkout instant-on-v3.16.1 \
&& make \
&& make DESTDIR=/tmp/criu-3.16.1 install-lib install-criu \
&& cd .. \
&& rm -fr criu
# Install CRIU.
FROM base
COPY --from=criu-builder /tmp/criu-3.16.1/usr/local /usr/local
# Set CRIU capabilities.
RUN setcap cap_checkpoint_restore,cap_sys_ptrace,cap_net_admin=eip /usr/local/sbin/criu
# Run ldconfig to discover newly installed shared libraries.
RUN for dir in lib lib64 lib/x86_64-linux-gnu ; do echo /usr/local/$dir ; done > /etc/ld.so.conf.d/usr-local.conf \
&& ldconfig
# Get Semeru InstantOn
RUN cd / \
&& mkdir -p /instantOnDemo/Scripts \
&& mkdir /instantOnDemo/CRIUNatives \
&& chown -R 1001:0 /instantOnDemo \
&& cd instantOnDemo \
&& wget --progress=dot:mega -O semeruInstantOn.tar.gz https://github.com/ibmruntimes/semeru17-ea-binaries/releases/download/jdk-17.0.6%2B10_march_23-preview_1/ibm-semeru-open-jdk_x64_linux_17.0.6_10_March_23-preview_1.tar.gz \
&& mkdir semeruInstantOn \
&& tar -xzf semeruInstantOn.tar.gz -C semeruInstantOn --strip-components 1\
&& rm -rf semeruInstantOn.tar.gz
ENV JAVA_HOME=/instantOnDemo/semeruInstantOn
ENV PATH=$JAVA_HOME/bin:/instantOnDemo:$PATH
WORKDIR /instantOnDemo
COPY --chown=1001:0 Scripts/common/* /instantOnDemo/Scripts/
COPY --chown=1001:0 Scripts/unprivileged/* /instantOnDemo/Scripts/
COPY --chown=1001:0 Samples/* /instantOnDemo/
COPY --chown=1001:0 CRIUNatives/* /instantOnDemo/CRIUNatives/
RUN chmod a+rx /instantOnDemo/Scripts/*
#compile CRIU natives lib
RUN cd /instantOnDemo/CRIUNatives \
&& gcc -c -std=c99 -fPIC -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux -D_POSIX_C_SOURCE=200809L -Wall -O0 -g3 CRIUNatives.c \
&& gcc -shared -o libcriunatives.so CRIUNatives.o -L/usr/local/lib/x86_64-linux-gnu -lcriu -Wl,-rpath=/usr/lib/x86_64-linux-gnu \
&& javac com/demo/CRIUNatives.java \
&& jar --create --file criunatives.jar * \
&& mv criunatives.jar .. \
&& mv libcriunatives.so ..