-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
49 lines (36 loc) · 1.18 KB
/
Dockerfile
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
FROM debian:buster as dds-builder
RUN apt-get update
# Install only minimum required packages
RUN apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
git \
g++ \
ninja-build
# Make sure sources are the latest for the build operation
ARG CACHEBUST=1
ADD libdds /app
RUN rm -rf /app/.build && \
mkdir -p /app/.build
WORKDIR /app/.build
# Configure using RelWithDebInfo. This will help if system is setup to generate
# a core file in case of crash. Installation prefix is /usr. It uses Ninja
# generator which has better cmake generator than recursive Makefiles.
RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \
-G Ninja \
.. && \
# Compile the library
ninja && \
# Install only runtime files into /app/.build/install
# (Required step because it can modify RUNPATH)
env DESTDIR=install cmake -DCMAKE_INSTALL_COMPONENT=Runtime -P cmake_install.cmake
FROM python:3.7-buster
# Copy installed runtime files to real image
COPY --from=dds-builder /app/.build/install/usr/lib /usr/lib
RUN mkdir -p /app
WORKDIR /app
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY /src/ /app/
ENV FLASK_APP "api.py"