bitterapricot commited on
Commit
1a32078
·
1 Parent(s): 919dc7f

add nodjs.

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -0
  2. cpppy_app/CMakeLists.txt +24 -0
Dockerfile CHANGED
@@ -5,12 +5,18 @@ FROM python:3.9
5
 
6
  # 安装运行时依赖
7
  RUN apt-get update && apt-get install -y \
 
8
  nginx \
9
  supervisor \
10
  curl \
11
  libgomp1 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
 
 
14
  RUN useradd -m -u 1000 user
15
  RUN chown -R user:user /var/lib/nginx/ \
16
  && chmod -R 755 /var/lib/nginx \
 
5
 
6
  # 安装运行时依赖
7
  RUN apt-get update && apt-get install -y \
8
+ gcc g++ cmake make gnupg \
9
  nginx \
10
  supervisor \
11
  curl \
12
  libgomp1 \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # 安装 Node.js
16
+ RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
17
+ && apt-get install -y nodejs \
18
+ && npm install -g npm@latest
19
+
20
  RUN useradd -m -u 1000 user
21
  RUN chown -R user:user /var/lib/nginx/ \
22
  && chmod -R 755 /var/lib/nginx \
cpppy_app/CMakeLists.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cmake_minimum_required(VERSION 3.10)
2
+ project(cpp_extension)
3
+
4
+ # 查找 Python
5
+ find_package(Python3 COMPONENTS Development REQUIRED)
6
+
7
+ # 添加 pybind11
8
+ add_subdirectory(pybind11)
9
+ pybind11_add_module(cpp_extension cpp_module.cpp)
10
+
11
+ # 设置编译选项
12
+ set_target_properties(cpp_extension PROPERTIES
13
+ CXX_STANDARD 11
14
+ CXX_STANDARD_REQUIRED ON
15
+ POSITION_INDEPENDENT_CODE ON
16
+ )
17
+
18
+ # 链接库
19
+ target_link_libraries(cpp_extension PRIVATE pybind11::module)
20
+
21
+ # 安装目标
22
+ install(TARGETS cpp_extension
23
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
24
+ )