-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
63 lines (50 loc) · 1.44 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#===== Stage 1: Build spyce =====#
FROM debian:stable-slim as stage1
# Adding needed libraries
RUN apt-get update &&\
apt-get install -y \
curl \
libboost-python-dev \
libboost-filesystem-dev \
build-essential \
python3-dev
RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.sh -o curl.sh &&\
chmod +x curl.sh &&\
./curl.sh --skip-license --prefix=/usr
# create stage directory
WORKDIR /stage1
#copy spyce src files
COPY ./spyce /stage1/spyce
COPY ./CMakeLists.txt /stage1/
#build
RUN mkdir build
RUN cmake . && make
#===== Stage 2: NPM and parceling =====#
FROM node:latest as stage2
# create stage directory
WORKDIR /stage2
#copy web folder contents
COPY ./web /stage2/web
COPY ./package.json /stage2/
COPY ./.babelrc /stage2/
#build
RUN npm install
RUN npm run build
#===== Stage 3: Python + Final =====#
FROM debian:stable-slim as flaskapp
# Adding globally needed libraries
RUN apt-get update
RUN apt-get install -y libboost-python-dev
RUN apt-get install -y libboost-filesystem-dev
RUN apt-get install -y python3-pip
RUN pip3 install flask
#create app directory
WORKDIR /app
# Copy relevant files
COPY --from=stage1 /spyce/spyce.so /app/spyce.so
COPY --from=stage2 /stage2/dist /app/dist
COPY FlaskServer.py /app
COPY config/ /app/config/
EXPOSE 5000
# Start Flask Server
CMD [ "python3", "FlaskServer.py" ]