Skip to content

Commit

Permalink
Add rockylinux Dockerfile && Update Dockerfile (#348)
Browse files Browse the repository at this point in the history
* Update Dockerfile

* Add rockylinux Dockerfile
  • Loading branch information
fantasy-peak authored Nov 16, 2023
1 parent 81d5648 commit cd12c24
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 51 deletions.
22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,10 @@ bazel build --copt='-O0' --copt='-ggdb' ...

# Docker Compile Environment
```
# for centos-7
git clone https://github.com/alibaba/async_simple.git
cd async_simple/docker/centos7
docker build . --no-cache -t async_simple:1.0 --network host
docker run -it --name test-async-simple async_simple:1.0 /bin/bash
// Has entered centos bash shell
mkdir build && cd build
cmake3 .. -DCMAKE_BUILD_TYPE=Release
# for ubuntu 22.04
git clone https://github.com/alibaba/async_simple.git
cd async_simple/docker/ubuntu
docker build . --no-cache -t async_simple:1.0 --network host
docker run -it --name test-async-simple async_simple:1.0 /bin/bash
// Has entered ubuntu bash shell
mkdir build && cd build
# use clang for compile
CXX=clang++-13 CC=clang-13 cmake .. -DCMAKE_BUILD_TYPE=Release
# use g++ for compile
CXX=g++-11 CC=gcc-11 cmake .. -DCMAKE_BUILD_TYPE=Release
cd async_simple/docker/(ubuntu|centos7|rockylinux)
docker build . --no-cache -t async_simple:1.0
docker run -it --name async_simple async_simple:1.0 /bin/bash
```

# Get Started
Expand Down
22 changes: 3 additions & 19 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,10 @@ bazel build --copt='-O0' --copt='-ggdb' ...

# Docker 编译环境
```
# 使用 centos-7
git clone https://github.com/alibaba/async_simple.git
cd async_simple/docker/centos7
docker build . --no-cache -t async_simple:1.0 --network host
docker run -it --name test-async-simple async_simple:1.0 /bin/bash
// 已经进入 centos bash shell
mkdir build && cd build
cmake3 .. -DCMAKE_BUILD_TYPE=Release
# 使用 ubuntu 22.04
git clone https://github.com/alibaba/async_simple.git
cd async_simple/docker/ubuntu
docker build . --no-cache -t async_simple:1.0 --network host
docker run -it --name test-async-simple async_simple:1.0 /bin/bash
// 已经进入 ubuntu bash shell
mkdir build && cd build
# 使用 clang 编译
CXX=clang++-13 CC=clang-13 cmake .. -DCMAKE_BUILD_TYPE=Release
# 使用 g++ 编译
CXX=g++-11 CC=gcc-11 cmake .. -DCMAKE_BUILD_TYPE=Release
cd async_simple/docker/(ubuntu|centos7|rockylinux)
docker build . --no-cache -t async_simple:1.0
docker run -it --name async_simple async_simple:1.0 /bin/bash
```

# 更多示例
Expand Down
12 changes: 9 additions & 3 deletions docker/centos7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /root

RUN yum update --nogpgcheck -y \
&& yum install --nogpgcheck -y epel-release centos-release-scl \
&& yum install --nogpgcheck -y devtoolset-11-gcc-c++ libaio-devel.x86_64 git cmake3

RUN echo "source /opt/rh/devtoolset-11/enable" >> .bashrc

ENV ASYNC_SIMPLE_ROOT="/root/async_simple"
RUN git clone https://github.com/alibaba/async_simple.git $ASYNC_SIMPLE_ROOT
WORKDIR $ASYNC_SIMPLE_ROOT
RUN git clone https://github.com/alibaba/async_simple.git \
&& source /opt/rh/devtoolset-11/enable \
&& cd async_simple \
&& mkdir build && cd build \
&& cmake3 .. -DCMAKE_BUILD_TYPE=Release -DASYNC_SIMPLE_ENABLE_TESTS=OFF \
&& make -j 9

WORKDIR /root/async_simple
19 changes: 19 additions & 0 deletions docker/rockylinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM rockylinux:9.2

WORKDIR /root

RUN dnf update -y \
&& dnf install -y cmake.x86_64 git.x86_64 clang.x86_64 libaio-devel.x86_64 gcc.x86_64 gcc-c++.x86_64

RUN git clone https://github.com/alibaba/async_simple.git
RUN cd async_simple \
&& mkdir clang_build && cd clang_build \
&& CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=Release -DASYNC_SIMPLE_ENABLE_TESTS=OFF \
&& make -j 9

RUN cd async_simple \
&& mkdir gcc_build && cd gcc_build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release \
&& make -j 9 && ctest

WORKDIR /root/async_simple
27 changes: 17 additions & 10 deletions docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM ubuntu:22.04

ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8

WORKDIR /root

RUN apt-get update -y \
&& apt-get install -y cmake git clang-13 libaio-dev libgtest-dev libgmock-dev gcc-11 g++-11
&& apt-get install -y cmake git clang-13 libaio-dev libgtest-dev libgmock-dev gcc-12 g++-12 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-13 100 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-13 100

RUN git clone https://github.com/alibaba/async_simple.git
RUN cd async_simple \
&& mkdir clang_build && cd clang_build \
&& CXX=clang++ CC=clang cmake .. -DCMAKE_BUILD_TYPE=Release \
&& make -j 9 && ctest

RUN cd async_simple \
&& mkdir gcc_build && cd gcc_build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release \
&& make -j 9 && ctest

ENV ASYNC_SIMPLE_ROOT="/root/async_simple"
RUN git clone https://github.com/alibaba/async_simple.git $ASYNC_SIMPLE_ROOT
WORKDIR $ASYNC_SIMPLE_ROOT
WORKDIR /root/async_simple

0 comments on commit cd12c24

Please sign in to comment.