diff --git a/README.md b/README.md index 5b1e04b..33694c6 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ xmake install -o . --file=./test_xmake.lua ./bin/coro_frpc_bi ``` +## Docker compilation environment +``` +git clone https://github.com/fantasy-peak/frpc.git +cd frpc && cd docker && make +``` + ## Type Mapping | frpc type | c++ type | frpc type | c++ type | |---------|--------------------|---------|--------------------| @@ -79,6 +85,7 @@ HelloWorldApi: inputs: bank_info: {type: BankInfo} blance: {type: u64} + date: {type: DateTime} # frpc DateTime type outputs: reply: {type: string} info: {type: Info} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..b045c91 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,50 @@ +ARG ROCKY_LINUX_VERSIONS + +FROM rockylinux:${ROCKY_LINUX_VERSIONS} + +SHELL ["/bin/bash", "-c"] + +RUN update-ca-trust; \ + rm -f /etc/localtime; \ + ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime; \ + # dnf update -y; \ + dnf install -y \ + autoconf \ + automake \ + bison \ + bzip2 \ + cmake \ + git \ + libtool \ + make \ + openssh.x86_64 \ + openssh-clients \ + patch \ + rpm-build \ + tar \ + wget \ + libuuid-devel.x86_64 \ + clang-tools-extra.x86_64 \ + gcc-toolset-13* \ + which \ + yum-utils; \ + dnf clean all + +RUN echo "source /opt/rh/gcc-toolset-13/enable" >> ~/.bashrc + +WORKDIR /root + +RUN source ~/.bashrc \ + &&curl -kfsSL https://xmake.io/shget.text | bash -s v2.9.1 \ + && echo "export XMAKE_ROOT=y" >> ~/.bashrc \ + && echo "source ~/.xmake/profile" >> ~/.bashrc + +RUN source ~/.bashrc \ + && xmake --version \ + && git clone https://github.com/fantasy-peak/frpc.git \ + && cd frpc \ + && xmake build -v -y --file=./xmake.lua \ + && xmake install -o . --file=./xmake.lua \ + && ./bin/frpc -f ./config/config.yaml -t ./template/cpp -o ./out -w ./template/web --auto_sort=0 --debug=0 \ + && xmake build -v -y --file=./test_xmake.lua \ + && xmake install -o . --file=./test_xmake.lua diff --git a/docker/makefile b/docker/makefile new file mode 100644 index 0000000..9347d52 --- /dev/null +++ b/docker/makefile @@ -0,0 +1,24 @@ +ROCKY_LINUX_VERSIONS := 8.9.20231119 +REPOSITORY_NAME := rockylinux-frpc +CONTAINER := "rockylinux-frpc" + +.PONY: $(ROCKY_LINUX_VERSIONS) +default: $(ROCKY_LINUX_VERSIONS) + + +$(ROCKY_LINUX_VERSIONS): + @echo "----(${REPOSITORY_NAME}:${ROCKY_LINUX_VERSIONS})" + # docker build --progress=plain --no-cache --build-arg ROCKY_LINUX_VERSIONS=$@ -t ${REPOSITORY_NAME}:$@ . + docker build --progress=plain --build-arg ROCKY_LINUX_VERSIONS=$@ -t ${REPOSITORY_NAME}:$@ . + +del: + docker rm -f ${CONTAINER} + docker rmi -f ${REPOSITORY_NAME}:${ROCKY_LINUX_VERSIONS} + +run: + docker run -it -v /var/run/docker.sock:/var/run/docker.sock --net=host --privileged --name ${CONTAINER} ${REPOSITORY_NAME}:${ROCKY_LINUX_VERSIONS} + +login: + docker start $(CONTAINER) + docker exec -i -t $(CONTAINER) /bin/bash +