Skip to content

Commit 9e7c3f2

Browse files
committed
fix docker file
1 parent af06ae8 commit 9e7c3f2

File tree

9 files changed

+91
-37
lines changed

9 files changed

+91
-37
lines changed

docker-files/cpp/Dockerfile

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:18.04 as builder
1+
FROM wedpr_component_vcpkg_cache:latest as builder
22

33
LABEL maintainer [email protected]
44

@@ -8,26 +8,12 @@ ARG SOURCE_BRANCH
88
ENV DEBIAN_FRONTEND=noninteractive \
99
SOURCE=${SOURCE_BRANCH:-master}
1010

11-
RUN apt-get -q update && apt-get install -qy --no-install-recommends \
12-
vim curl git make build-essential cmake \
13-
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config curl zip tar ccache uuid-runtime automake autoconf \
14-
m4 tcpdump net-tools libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev gcc g++ \
15-
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
16-
&& apt-get install -qy --no-install-recommends tzdata \
17-
&& dpkg-reconfigure --frontend noninteractive tzdata \
18-
&& rm -rf /var/lib/apt/lists/*
19-
20-
# install rust
21-
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
22-
23-
ENV PATH="/root/.cargo/bin:${PATH}"
24-
25-
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
26-
27-
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
28-
&& mkdir -p WeDPR-Component/cpp/build && cd WeDPR-Component/cpp/build \
29-
&& cmake .. -DBUILD_STATIC=ON && make -j8 && cat /WeDPR-Component/cpp/build/*.log
30-
11+
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
12+
# ln the cached vcpkg and compile
13+
RUN cd WeDPR-Component/cpp && rm -rf vcpkg && ln -s /vcpkg \
14+
&& mkdir -p build && cd build \
15+
&& cmake .. -DBUILD_STATIC=ON \
16+
&& make -j8
3117

3218
FROM ubuntu:18.04 as wedpr-gateway-service
3319
LABEL maintainer [email protected]
@@ -44,7 +30,6 @@ COPY --from=builder /WeDPR-Component/cpp/build/bin/ppc-gateway-service /data/hom
4430

4531
ENTRYPOINT ["/data/home/wedpr/wedpr-gateway-service/ppc-gateway-service", "-c", "config.ini"]
4632

47-
4833
FROM ubuntu:18.04 as wedpr-pro-node-service
4934
LABEL maintainer [email protected]
5035

docker-files/cpp/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
echo "========= BUILD IMAGES for WEDPR-COMPONENT, BRANCH: ${1} ========="
3+
4+
echo "* build wedpr-gateway-service image"
5+
docker build --target wedpr-gateway-service --build-arg SOURCE_BRANCH=${1} -t wedpr-gateway-service .
6+
echo "* build wedpr-gateway-service image success"
7+
8+
echo "* build wedpr-pro-node-service image"
9+
docker build --target wedpr-pro-node-service --build-arg SOURCE_BRANCH=${1} -t wedpr-pro-node-service .
10+
echo "* build wedpr-pro-node-service image success"
11+
12+
echo "* build wedpr-mpc-service image"
13+
docker build --target wedpr-mpc-service --build-arg SOURCE_BRANCH=${1} -t wedpr-mpc-service .
14+
echo "* build wedpr-mpc-service image success"
15+
16+
echo "========= BUILD IMAGES for WEDPR-COMPONENT, BRANCH: ${1} ========="

docker-files/cpp/vcpkg/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:18.04 as wedpr_component_vcpkg_cache
2+
3+
LABEL maintainer [email protected]
4+
5+
WORKDIR /
6+
7+
ARG SOURCE_BRANCH
8+
ENV DEBIAN_FRONTEND=noninteractive \
9+
SOURCE=${SOURCE_BRANCH:-master}
10+
11+
RUN apt-get -q update && apt-get install -qy --no-install-recommends \
12+
vim curl git make build-essential cmake \
13+
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config curl zip tar ccache uuid-runtime automake autoconf \
14+
m4 tcpdump net-tools libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev gcc g++ \
15+
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
16+
&& apt-get install -qy --no-install-recommends tzdata \
17+
&& dpkg-reconfigure --frontend noninteractive tzdata \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# install rust
21+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
22+
23+
ENV PATH="/root/.cargo/bin:${PATH}"
24+
25+
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
26+
27+
# first download and compile the vcpkg dependecies
28+
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
29+
&& mkdir -p WeDPR-Component/cpp/build && cd WeDPR-Component/cpp/build \
30+
&& cmake .. -DBUILD_STATIC=ON \
31+
32+
# move the vcpkg dependecies to /vcpkg
33+
RUN mv /WeDPR-Component/cpp/vcpkg /
34+

docker-files/cpp/vcpkg/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
echo "* build image: wedpr_component_vcpkg_cache, branch: ${1}"
3+
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr_component_vcpkg_cache .
4+
echo "* build image: wedpr_component_vcpkg_cache success, branch: ${1}"

docker-files/model/base/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM wedpr-image:latest as wedpr-model-service-base-image
2+
3+
LABEL maintainer [email protected]
4+
5+
RUN apt-get install -qy --no-install-recommends libkrb5-dev pkg-config default-libmysqlclient-dev
6+
RUN mkdir -p /data/home/wedpr
7+
# copy requirements
8+
COPY depends/requirements.txt /data/home/wedpr/requirements.txt
9+
10+
# install the requirements
11+
RUN pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ -r /data/home/wedpr/requirements.txt

docker-files/model/base/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
echo "* build image: wedpr-model-service-base-image"
3+
docker build -t wedpr-model-service-base-image .
4+
echo "* build image: wedpr-model-service-base-image success"
File renamed without changes.
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM wedpr-image:latest as wedpr-model-service
2-
1+
FROM wedpr-model-service-base-image:latest as wedpr-model-service
32
LABEL maintainer [email protected]
43

54
ENV LANG zh_CN.UTF-8
@@ -9,23 +8,20 @@ ENV LC_ALL zh_CN.UTF-8
98
WORKDIR /data/home/wedpr
109
ARG SOURCE_BRANCH
1110
ENV DEBIAN_FRONTEND=noninteractive \
12-
SOURCE=${SOURCE_BRANCH:-master}
13-
14-
RUN mkdir -p /data/home/wedpr
15-
# copy requirements
16-
COPY depends/requirements.txt /data/home/wedpr/requirements.txt
11+
SOURCE=${SOURCE_BRANCH:-main}
1712

18-
# install the requirements
19-
RUN pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple/ -r /data/home/wedpr/requirements.txt
13+
# install the gateway sdk
14+
# TODO: replace with pypip
15+
RUN pip install -i https://test.pypi.org/simple/ wedpr-python-gateway-sdk
2016

21-
# obtain the source
22-
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE}
17+
# obtain the source, no need to fetch the submodule(vcpkg) here
18+
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git -b ${SOURCE}
2319
# move the files to the /data/app path
2420
RUN mkdir -p /data/home/wedpr/wedpr-model/ \
25-
&& mv /data/home/wedpr/WeDPR-Component/python/ppc_common /data/home/wedpr/wedpr-model/ppc-common \
26-
&& mv /data/home/wedpr/WeDPR-Component/python/ppc_model /data/home/wedpr/wedpr-model/ppc-model \
27-
&& mv /data/home/wedpr/WeDPR-Component/python/aes_key.bin /data/home/wedpr/wedpr-model/ppc-model \
28-
&& cp /data/home/wedpr/model/ppc-model/tools/*.sh /data/home/wedpr/wedpr-model/ppc-model
21+
&& mv /data/home/wedpr/WeDPR-Component/python/ppc_common /data/home/wedpr/wedpr-model/ppc_common \
22+
&& mv /data/home/wedpr/WeDPR-Component/python/ppc_model /data/home/wedpr/wedpr-model/ppc_model \
23+
&& mv /data/home/wedpr/WeDPR-Component/python/aes_key.bin /data/home/wedpr/wedpr-model/ppc_model \
24+
&& cp /data/home/wedpr/WeDPR-Component/Python/ppc_model/tools/*.sh /data/home/wedpr/wedpr-model/ppc_model
2925

3026
# clear the WeDPR-Component
3127
RUN rm -rf /data/home/wedpr/WeDPR-Component

docker-files/model/model/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
echo "* build image: wedpr-model-service, branch: ${1}"
3+
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr-model-service .
4+
echo "* build image: wedpr-model-service success, branch: ${1}"

0 commit comments

Comments
 (0)