forked from nam20485/OdbDesign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile (exe)
82 lines (69 loc) · 2.73 KB
/
Dockerfile (exe)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
FROM debian:bookworm-20240110-slim@sha256:f4a83aa865a2b4a064ff142aa91c713180df9fcb86ce676b5de2981029379c37 AS build
# install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gpg \
curl \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
g++ \
ninja-build \
python3-dev \
#python3-pip \
#python3-virtualenv \
# mingw-w64 \
swig
# add MS PowerShell repo
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --yes --dearmor --output /usr/share/keyrings/microsoft.gpg
RUN sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
# install PowerShell
RUN apt-get update && \
apt-get install -y --no-install-recommends \
powershell
# copy source
RUN mkdir -p /src/OdbDesign
WORKDIR /src/OdbDesign
COPY . .
# generate SWIG python bindings
RUN chmod +x scripts/generate-python-module.ps1
RUN scripts/generate-python-module.ps1
# configure & build using presets
# linux-release
RUN cmake --preset linux-release
RUN cmake --build --preset linux-release
# # linux-debug
# RUN cmake --preset linux-debug
# RUN cmake --build --preset linux-debug
## build PyOdbDesignLib python package
#RUN python3 -m pip install -r PyOdbDesignLib/pkg-build-requirements.txt --break-system-packages
WORKDIR /src/OdbDesign/PyOdbDesignLib
# copy C++ wrapper library to a format that Python expects for extension modules
RUN cp /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so ./_PyOdbDesignLib.so
## build Python package
#RUN python3 -m build
# much smaller runtime image
FROM debian:bookworm-20240110-slim@sha256:f4a83aa865a2b4a064ff142aa91c713180df9fcb86ce676b5de2981029379c37 AS run
RUN mkdir /OdbDesign
WORKDIR /OdbDesign
# copy binaries
RUN mkdir bin
COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so ./bin/
COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignApp/OdbDesignApp ./bin/
# copy Python files
COPY --from=build /src/OdbDesign/PyOdbDesignLib /OdbDesign/PyOdbDesignLib
# install Python3 dev
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-dev
#python3-pip \
#python3-virtualenv
# # install package into Python environment
# RUN python3 -m pip install --break-system-packages \
# --no-index \
# --find-links PyOdbDesignLib/dist/*.whl \
# PyOdbDesignLib
# run
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/OdbDesign/bin
ENTRYPOINT [ "bin/OdbDesignApp" ]