Skip to content

Commit 1d348e7

Browse files
committed
docker: added dockerfile for build in ubuntu22.
Signed-off-by: Wine93 <[email protected]> Signed-off-by: fine97 <[email protected]>
1 parent d8a1137 commit 1d348e7

File tree

6 files changed

+99
-19
lines changed

6 files changed

+99
-19
lines changed

.obm.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
container_name: curve-build-playground.master
2-
container_image: opencurvedocker/curve-base:build-debian11
2+
container_image: opencurvedocker/curve-build:ubuntu22

curvefs/sdk/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ How to build
66

77
``` bash
88
$ git clone [email protected]:opencurve/curve.git
9-
$ cd curve
10-
$ make dep stor=fs
9+
$ make playground
10+
$ make ci-dep stor=fs
1111
$ make sdk
1212
```
1313

14-
It will generate a jar after build success:
14+
It will generate a jar package after build success:
1515

1616
```
1717
Build SDK success => /curve/curvefs/sdk/output/curvefs-hadoop-1.0-SNAPSHOT.jar

docker/ubuntu22/compile/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu:22.04
2+
3+
LABEL maintainer="Wine93 <[email protected]>"
4+
5+
ENV TZ=Asia/Shanghai \
6+
LANG=C.UTF-8 \
7+
LC_ALL=C.UTF-8
8+
9+
COPY setup.sh .setup.sh
10+
RUN bash .setup.sh

docker/ubuntu22/compile/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: build
2+
3+
build:
4+
docker build -t opencurvedocker/curve-build:ubuntu22 .

docker/ubuntu22/compile/setup.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
g_bazelisk_url="https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
4+
g_protoc_url="https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protoc-21.8-linux-x86_64.zip"
5+
6+
cat << EOF > /etc/apt/sources.list
7+
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
8+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
9+
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
10+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
11+
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
12+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
13+
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
14+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
15+
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
16+
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
17+
EOF
18+
19+
apt-get clean
20+
apt-get -y update
21+
apt-get -y install --no-install-recommends \
22+
bison \
23+
build-essential \
24+
cmake \
25+
default-jdk \
26+
flex \
27+
git \
28+
golang \
29+
libcurl4-gnutls-dev \
30+
libfiu-dev \
31+
libfuse3-dev \
32+
libhashkit-dev \
33+
liblz4-dev \
34+
libsnappy-dev \
35+
libssl-dev \
36+
libz-dev \
37+
make \
38+
maven \
39+
musl \
40+
musl-dev \
41+
musl-tools \
42+
python3-pip \
43+
sudo \
44+
tree \
45+
unzip \
46+
uuid-dev \
47+
vim \
48+
wget
49+
apt-get autoremove -y
50+
51+
wget "${g_bazelisk_url}" -O /usr/bin/bazel
52+
chmod a+x /usr/bin/bazel
53+
54+
g_protoc_zip="/tmp/protoc.zip"
55+
wget "${g_protoc_url}" -O ${g_protoc_zip}
56+
unzip ${g_protoc_zip} "bin/protoc" -d /usr
57+
rm -f ${g_protoc_zip}
58+
59+
cat << EOF >> ~/.bashrc
60+
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
61+
export GOPATH=${HOME}/go
62+
export PATH=\$JAVA_HOME/bin:\$PATH
63+
EOF

util/playground.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
# Copyright (C) 2023 Jingli Chen (Wine93), NetEase Inc.
44

5-
# see also: https://github.com/Burnett01/rsync-deployments/issues/21
6-
75
############################ GLOBAL VARIABLES
86
g_obm_cfg=".obm.cfg"
97
g_worker_dir="/curve"
108
g_container_name="curve-build-playground.master"
11-
g_container_image="opencurvedocker/curve-base:build-debian11"
9+
g_container_image="opencurvedocker/curve-build:ubuntu22"
1210
g_init_script=$(cat << EOF
1311
useradd -m -s /bin/bash -N -u $UID $USER
1412
echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
@@ -17,15 +15,22 @@ chmod g+w /etc/passwd
1715
echo 'alias ls="ls --color"' >> /home/${USER}/.bashrc
1816
EOF
1917
)
20-
g_install_script=$(cat << EOF
21-
apt-get update
22-
apt-get -y install tree rsync golang jq vim python3-pip maven >/dev/null
23-
curl -sSL https://bit.ly/install-xq | sudo bash >/dev/null 2>&1
24-
pip3 install cpplint >/dev/null 2>/dev/null
25-
EOF
26-
)
2718

2819
############################ BASIC FUNCTIONS
20+
msg() {
21+
printf '%b' "$1" >&2
22+
}
23+
24+
success() {
25+
msg "\33[32m[✔]\33[0m ${1}${2}"
26+
}
27+
28+
die() {
29+
msg "\33[31m[✘]\33[0m ${1}${2}"
30+
exit 1
31+
}
32+
33+
############################ FUNCTIONS
2934
parse_cfg() {
3035
local args=`getopt -o v: --long version: -n "playground.sh" -- "$@"`
3136
eval set -- "${args}"
@@ -51,13 +56,13 @@ create_container() {
5156
--env "UID=$(id -u)" \
5257
--env "USER=${USER}" \
5358
--env "TZ=Asia/Shanghai" \
54-
--hostname "playground" \
59+
--hostname "${g_container_name}" \
5560
--name "${g_container_name}" \
5661
--workdir ${g_worker_dir} \
5762
"${g_container_image}"
63+
5864
docker exec "${g_container_name}" bash -c "${g_init_script}"
59-
docker exec "${g_container_name}" bash -c "${g_install_script}"
60-
success "create ${g_container_name} (${g_container_image}) success :)"
65+
success "create ${g_container_name} (${g_container_image}) success :)\n"
6166
}
6267

6368
enter_container() {
@@ -68,9 +73,7 @@ enter_container() {
6873
"${g_container_name}" /bin/bash
6974
}
7075

71-
7276
main() {
73-
source "util/basic.sh"
7477
parse_cfg "$@"
7578
create_container
7679
enter_container

0 commit comments

Comments
 (0)