-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b4e793
commit 122da69
Showing
5 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# myframe docker | ||
主要用于创建myframe docker容器镜像; | ||
包含编译好的myframe,可以运行example,benchmark和创建运行组件工程。 | ||
|
||
## 目录 | ||
myframe安装目录:`/usr/local` | ||
|
||
## 构建docker镜像 | ||
```sh | ||
bash docker_build.bash <myframe_version> | ||
``` | ||
|
||
## 创建运行docker容器 | ||
```sh | ||
docker run -itd \ | ||
--name "myframe_run" \ | ||
myframe:${<myframe_version>} \ | ||
/bin/bash | ||
``` | ||
|
||
## 进入docker容器 | ||
```sh | ||
docker exec -it \ | ||
-it "myframe_run" \ | ||
/bin/bash | ||
``` | ||
|
||
## 在docker中开发 | ||
[开发手册](../doc/development_guide.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
readonly PWD0="$(dirname "$(readlink -fn "$0")")" | ||
readonly MYFRAME_ROOT="$(dirname ${PWD0})" | ||
|
||
readonly IMAGE_NAME="myframe" | ||
|
||
set -e | ||
|
||
function main { | ||
cd "${PWD0}" | ||
|
||
local -a cmd=() | ||
if command -v docker; then | ||
cmd+=("docker" "build") | ||
else | ||
echo "No docker existed!" | ||
exit 1 | ||
fi | ||
|
||
local arc="$(uname -m)" | ||
case "${arc}" in | ||
"aarch64" | "arm64") | ||
arc="aarch64" | ||
;; | ||
"x86_64" | "amd64") | ||
arc="amd64" | ||
;; | ||
*) | ||
echo "Unknown arch: ${arc}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
local tag="${arc}-$1" | ||
|
||
"${cmd[@]}" \ | ||
--build-arg myframe_version=$1 \ | ||
--ulimit nofile=102400:102400 \ | ||
-f "ubuntu2004.dockerfile" \ | ||
-t "${IMAGE_NAME}:${tag}" \ | ||
"${MYFRAME_ROOT}" | ||
} | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Error: No arguments provided. Usage: $0 \"myframe_version\"" | ||
exit 1 | ||
fi | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FROM docker.io/library/ubuntu:20.04 | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
COPY docker/ubuntu2004.sourcelist /etc/apt/sources.list | ||
RUN yes | unminimize | ||
RUN apt update \ | ||
&& apt install -y --no-install-recommends \ | ||
build-essential cmake \ | ||
wget python3 vim \ | ||
libunwind-dev libgflags-dev | ||
|
||
WORKDIR /tmp | ||
RUN wget -q --content-disposition --no-check-certificate \ | ||
https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz | ||
RUN tar -xf jsoncpp-1.9.5.tar.gz \ | ||
&& cmake -S jsoncpp-1.9.5 -B build-jsoncpp \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
-DBUILD_OBJECT_LIBS=OFF \ | ||
-DJSONCPP_WITH_TESTS=OFF \ | ||
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \ | ||
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF \ | ||
&& cmake --build build-jsoncpp --target install \ | ||
&& rm -rf jsoncpp-1.9.5.tar.gz jsoncpp-1.9.5 build-jsoncpp | ||
|
||
RUN wget -q --content-disposition --no-check-certificate \ | ||
https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz | ||
RUN tar -xf glog-0.6.0.tar.gz \ | ||
&& cmake -S glog-0.6.0 -B build-glog \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
-DWITH_PKGCONFIG=OFF \ | ||
-DWITH_GTEST=OFF \ | ||
&& cmake --build build-glog --target install \ | ||
&& rm -rf glog-0.6.0.tar.gz glog-0.6.0 build-glog | ||
|
||
ARG myframe_version=latest | ||
RUN wget -q --content-disposition --no-check-certificate \ | ||
https://github.com/lkpworkspace/myframe/archive/refs/tags/v${myframe_version}.tar.gz | ||
RUN tar -xf myframe-${myframe_version}.tar.gz | ||
RUN cmake -S myframe-${myframe_version} -B build-myframe \ | ||
-DCMAKE_CXX_STANDARD=17 \ | ||
-DCMAKE_CXX_STANDARD_REQUIRED=ON \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
&& cmake --build build-myframe --target install \ | ||
&& rm -rf myframe-${myframe_version}.tar.gz myframe-${myframe_version} build-myframe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse | ||
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse | ||
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse | ||
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse |