Skip to content

Commit

Permalink
docker: added dockerfile for build in ubuntu22.
Browse files Browse the repository at this point in the history
Signed-off-by: Wine93 <[email protected]>
Signed-off-by: fine97 <[email protected]>
  • Loading branch information
Wine93 committed Nov 23, 2023
1 parent d8a1137 commit 1d348e7
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .obm.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
container_name: curve-build-playground.master
container_image: opencurvedocker/curve-base:build-debian11
container_image: opencurvedocker/curve-build:ubuntu22
6 changes: 3 additions & 3 deletions curvefs/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ How to build

``` bash
$ git clone [email protected]:opencurve/curve.git
$ cd curve
$ make dep stor=fs
$ make playground
$ make ci-dep stor=fs
$ make sdk
```

It will generate a jar after build success:
It will generate a jar package after build success:

```
Build SDK success => /curve/curvefs/sdk/output/curvefs-hadoop-1.0-SNAPSHOT.jar
Expand Down
10 changes: 10 additions & 0 deletions docker/ubuntu22/compile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:22.04

LABEL maintainer="Wine93 <[email protected]>"

ENV TZ=Asia/Shanghai \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8

COPY setup.sh .setup.sh
RUN bash .setup.sh
4 changes: 4 additions & 0 deletions docker/ubuntu22/compile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: build

build:
docker build -t opencurvedocker/curve-build:ubuntu22 .
63 changes: 63 additions & 0 deletions docker/ubuntu22/compile/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

g_bazelisk_url="https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64"
g_protoc_url="https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protoc-21.8-linux-x86_64.zip"

cat << EOF > /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
EOF

apt-get clean
apt-get -y update
apt-get -y install --no-install-recommends \
bison \
build-essential \
cmake \
default-jdk \
flex \
git \
golang \
libcurl4-gnutls-dev \
libfiu-dev \
libfuse3-dev \
libhashkit-dev \
liblz4-dev \
libsnappy-dev \
libssl-dev \
libz-dev \
make \
maven \
musl \
musl-dev \
musl-tools \
python3-pip \
sudo \
tree \
unzip \
uuid-dev \
vim \
wget
apt-get autoremove -y

wget "${g_bazelisk_url}" -O /usr/bin/bazel
chmod a+x /usr/bin/bazel

g_protoc_zip="/tmp/protoc.zip"
wget "${g_protoc_url}" -O ${g_protoc_zip}
unzip ${g_protoc_zip} "bin/protoc" -d /usr
rm -f ${g_protoc_zip}

cat << EOF >> ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
export GOPATH=${HOME}/go
export PATH=\$JAVA_HOME/bin:\$PATH
EOF
33 changes: 18 additions & 15 deletions util/playground.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

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

# see also: https://github.com/Burnett01/rsync-deployments/issues/21

############################ GLOBAL VARIABLES
g_obm_cfg=".obm.cfg"
g_worker_dir="/curve"
g_container_name="curve-build-playground.master"
g_container_image="opencurvedocker/curve-base:build-debian11"
g_container_image="opencurvedocker/curve-build:ubuntu22"
g_init_script=$(cat << EOF
useradd -m -s /bin/bash -N -u $UID $USER
echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
Expand All @@ -17,15 +15,22 @@ chmod g+w /etc/passwd
echo 'alias ls="ls --color"' >> /home/${USER}/.bashrc
EOF
)
g_install_script=$(cat << EOF
apt-get update
apt-get -y install tree rsync golang jq vim python3-pip maven >/dev/null
curl -sSL https://bit.ly/install-xq | sudo bash >/dev/null 2>&1
pip3 install cpplint >/dev/null 2>/dev/null
EOF
)

############################ BASIC FUNCTIONS
msg() {
printf '%b' "$1" >&2
}

success() {
msg "\33[32m[✔]\33[0m ${1}${2}"
}

die() {
msg "\33[31m[✘]\33[0m ${1}${2}"
exit 1
}

############################ FUNCTIONS
parse_cfg() {
local args=`getopt -o v: --long version: -n "playground.sh" -- "$@"`
eval set -- "${args}"
Expand All @@ -51,13 +56,13 @@ create_container() {
--env "UID=$(id -u)" \
--env "USER=${USER}" \
--env "TZ=Asia/Shanghai" \
--hostname "playground" \
--hostname "${g_container_name}" \
--name "${g_container_name}" \
--workdir ${g_worker_dir} \
"${g_container_image}"

docker exec "${g_container_name}" bash -c "${g_init_script}"
docker exec "${g_container_name}" bash -c "${g_install_script}"
success "create ${g_container_name} (${g_container_image}) success :)"
success "create ${g_container_name} (${g_container_image}) success :)\n"
}

enter_container() {
Expand All @@ -68,9 +73,7 @@ enter_container() {
"${g_container_name}" /bin/bash
}


main() {
source "util/basic.sh"
parse_cfg "$@"
create_container
enter_container
Expand Down

0 comments on commit 1d348e7

Please sign in to comment.