56 lines
1.9 KiB
Docker
56 lines
1.9 KiB
Docker
|
# 编译平台
|
||
|
FROM gctl:2.0 AS gctl_library
|
||
|
FROM ubuntu:20.04 AS builder
|
||
|
# 安装编译工具
|
||
|
RUN apt-get update && apt-get install -y g++ make cmake
|
||
|
# 安装依赖库
|
||
|
RUN apt-get install -y --no-install-recommends libfftw3-dev libnetcdf-dev gmt libgmt-dev libgsl-dev libncurses-dev
|
||
|
RUN apt-get install -y pkg-config
|
||
|
# 创建工作目录
|
||
|
WORKDIR /app
|
||
|
# 从代码库镜像中复制库文件和头文件
|
||
|
COPY --from=gctl_library /usr/local/lib /usr/local/lib
|
||
|
COPY --from=gctl_library /usr/local/include /usr/local/include
|
||
|
|
||
|
# 编译依赖库
|
||
|
COPY dep/editline-1.17.1 /app/dep/editline
|
||
|
RUN cd /app/dep/editline && ./configure --prefix=/usr/local && make && make install
|
||
|
|
||
|
# 拷贝源代码
|
||
|
COPY addnoise /app/addnoise
|
||
|
COPY cutprofile /app/cutprofile
|
||
|
COPY fractopo /app/fractopo
|
||
|
COPY gm3d /app/gm3d
|
||
|
COPY gmsh2vtk /app/gmsh2vtk
|
||
|
COPY gmshinfo /app/gmshinfo
|
||
|
COPY grd2xyz /app/grd2xyz
|
||
|
COPY handyman /app/handyman
|
||
|
COPY nc2other /app/nc2other
|
||
|
COPY ncget /app/ncget
|
||
|
COPY ncinfo /app/ncinfo
|
||
|
COPY shc2xyz /app/shc2xyz
|
||
|
COPY sph2plane /app/sph2plane
|
||
|
COPY tetgen2gmsh /app/tetgen2gmsh
|
||
|
COPY trackline /app/trackline
|
||
|
COPY triangle2gmsh /app/triangle2gmsh
|
||
|
COPY txtinfo /app/txtinfo
|
||
|
COPY xyz2nc /app/xyz2nc
|
||
|
COPY xyz2sph /app/xyz2sph
|
||
|
COPY dsviewer /app/dsviewer
|
||
|
COPY CMakeLists.txt .
|
||
|
COPY config.h.in .
|
||
|
# 编译gctl动态库
|
||
|
RUN mkdir build && cd build && cmake .. && make && make install
|
||
|
|
||
|
# 运行平台
|
||
|
FROM ubuntu:20.04
|
||
|
# 安装运行时必要依赖
|
||
|
RUN apt-get update && apt-get install -y libstdc++6
|
||
|
RUN apt-get install -y --no-install-recommends libfftw3-dev libnetcdf-dev gmt libgmt-dev libgsl-dev libncurses-dev
|
||
|
# 从构建阶段复制编译后的库和头文件
|
||
|
COPY --from=builder /usr/local/lib /usr/local/lib
|
||
|
COPY --from=builder /usr/local/include /usr/local/include
|
||
|
COPY --from=builder /usr/local/sbin /usr/local/sbin
|
||
|
# 设置可执行文件列表
|
||
|
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
||
|
ENV PATH=$PATH:/usr/local/sbin
|