|
| 1 | +FROM ubuntu:22.04 |
| 2 | + |
| 3 | +ARG HTTP_PROXY |
| 4 | +ARG DEV_USERNAME |
| 5 | +ARG USER_UID |
| 6 | +ARG USER_GID |
| 7 | + |
| 8 | +ENV DEBIAN_FRONTEND=noninteractive |
| 9 | +ENV http_proxy=${HTTP_PROXY} |
| 10 | +ENV https_proxy=${HTTP_PROXY} |
| 11 | +ENV HTTP_PROXY=${HTTP_PROXY} |
| 12 | +ENV HTTPS_PROXY=${HTTP_PROXY} |
| 13 | +ENV ALL_PROXY=${HTTP_PROXY} |
| 14 | +ENV DORIS_BUILD_PYTHON_VERSION=python3 |
| 15 | +ENV DORIS_TOOLCHAIN=gcc |
| 16 | +ENV CLANGD_VERSION=21.1.0 |
| 17 | +ENV CLANGD_HOME=/usr/local/lib/clangd |
| 18 | +ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 |
| 19 | +ENV MAVEN_HOME=/usr/local/maven |
| 20 | +ENV PATH=${JAVA_HOME}/bin:${CLANGD_HOME}/bin:${MAVEN_HOME}/bin:${PATH} |
| 21 | +ENV TZ=Asia/Shanghai |
| 22 | + |
| 23 | +RUN \ |
| 24 | + # prepare apt |
| 25 | + sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \ |
| 26 | + sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \ |
| 27 | + echo 'Acquire::ForceIPv4 "true";' >> /etc/apt/apt.conf.d/1000-force-ipv4-transport && \ |
| 28 | + echo 'Acquire::Retries "100";' >> /etc/apt/apt.conf.d/80-retries && \ |
| 29 | + echo 'Acquire::http::Proxy "${HTTP_PROXY}";' >> /etc/apt/apt.conf.d/99-proxy && \ |
| 30 | + echo 'Acquire::https::Proxy "${HTTPS_PROXY}";' >> /etc/apt/apt.conf.d/99-proxy && \ |
| 31 | + apt-get update -y && \ |
| 32 | + # basics |
| 33 | + PKGS="software-properties-common" && \ |
| 34 | + apt-get install -y ${PKGS} && \ |
| 35 | + add-apt-repository -y ppa:ubuntu-toolchain-r/ppa && \ |
| 36 | + apt-get update -y && \ |
| 37 | + PKGS="vim sudo locales git curl unzip wget zip iputils-ping iproute2 tzdata tree jq" && \ |
| 38 | + PKGS="${PKGS} gdb net-tools telnet ccache linux-tools-common linux-tools-generic" && \ |
| 39 | + apt-get install -y ${PKGS} && \ |
| 40 | + locale-gen en_US.UTF-8 && \ |
| 41 | + echo ${TZ} > /etc/timezone && \ |
| 42 | + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ |
| 43 | + dpkg-reconfigure tzdata && \ |
| 44 | + # doris build deps |
| 45 | + PKGS="openjdk-17-jdk build-essential maven pkg-config cmake byacc flex automake libtool-bin bison binutils-dev libiberty-dev zip unzip libncurses5-dev curl git ninja-build python3" && \ |
| 46 | + PKGS="${PKGS} gcc-10 g++-10 autoconf automake libtool autopoint" && \ |
| 47 | + # misc |
| 48 | + PKGS="${PKGS} mysql-client" && \ |
| 49 | + apt-get install -y ${PKGS} && \ |
| 50 | + apt-get autoclean |
| 51 | + |
| 52 | +RUN \ |
| 53 | + # clangd |
| 54 | + wget "https://github.com/clangd/clangd/releases/download/${CLANGD_VERSION}/clangd-linux-${CLANGD_VERSION}.zip" -O /tmp/clangd.zip && \ |
| 55 | + unzip /tmp/clangd.zip -d ${CLANGD_HOME} && \ |
| 56 | + mv ${CLANGD_HOME}/clangd_${CLANGD_VERSION}/* ${CLANGD_HOME} && \ |
| 57 | + rm -rf ${CLANGD_HOME}/clangd_${CLANGD_VERSION} && \ |
| 58 | + rm -rf /tmp/clangd.zip && \ |
| 59 | + # maven |
| 60 | + wget https://mirrors.aliyun.com/apache/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.tar.gz -O /tmp/maven.tar.gz && \ |
| 61 | + tar -zxvf /tmp/maven.tar.gz -C /usr/local/ && \ |
| 62 | + mv /usr/local/apache-maven-3.9.11 ${MAVEN_HOME} && \ |
| 63 | + rm -rf /tmp/maven.tar.gz |
| 64 | + |
| 65 | +COPY settings.xml ${MAVEN_HOME}/conf |
| 66 | + |
| 67 | +RUN \ |
| 68 | + # proxy for wget |
| 69 | + echo "use_proxy = on" >> /etc/wgetrc && \ |
| 70 | + echo "http_proxy = ${http_proxy}" >> /etc/wgetrc && \ |
| 71 | + echo "https_proxy = ${http_proxy}" >> /etc/wgetrc && \ |
| 72 | + # misc |
| 73 | + echo "* soft core unlimited" >>/etc/security/limits.conf && \ |
| 74 | + mkdir /coredumps && \ |
| 75 | + chmod o+rwx /coredumps |
| 76 | + |
| 77 | +RUN \ |
| 78 | + # Create the user |
| 79 | + groupadd --gid $USER_GID $DEV_USERNAME \ |
| 80 | + && useradd --uid $USER_UID --gid $USER_GID -m $DEV_USERNAME \ |
| 81 | + # |
| 82 | + # [Optional] Add sudo support. Omit if you don't need to install software after connecting. |
| 83 | + && echo $DEV_USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$DEV_USERNAME \ |
| 84 | + && chmod 0440 /etc/sudoers.d/$DEV_USERNAME |
| 85 | + |
| 86 | +ENV LC_ALL="en_US.UTF-8" |
| 87 | +ENV LANG="en_US.UTF-8" |
| 88 | + |
| 89 | +USER $DEV_USERNAME |
| 90 | + |
| 91 | +# unset |
| 92 | +ENV http_proxy= |
| 93 | +ENV https_proxy= |
0 commit comments