Skip to content

Commit

Permalink
fix docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Dec 8, 2024
1 parent af06ae8 commit 9e7c3f2
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 37 deletions.
29 changes: 7 additions & 22 deletions docker-files/cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04 as builder
FROM wedpr_component_vcpkg_cache:latest as builder

LABEL maintainer [email protected]

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

RUN apt-get -q update && apt-get install -qy --no-install-recommends \
vim curl git make build-essential cmake \
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config curl zip tar ccache uuid-runtime automake autoconf \
m4 tcpdump net-tools libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev gcc g++ \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get install -qy --no-install-recommends tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

# install rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

ENV VCPKG_FORCE_SYSTEM_BINARIES=1

RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
&& mkdir -p WeDPR-Component/cpp/build && cd WeDPR-Component/cpp/build \
&& cmake .. -DBUILD_STATIC=ON && make -j8 && cat /WeDPR-Component/cpp/build/*.log

RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
# ln the cached vcpkg and compile
RUN cd WeDPR-Component/cpp && rm -rf vcpkg && ln -s /vcpkg \
&& mkdir -p build && cd build \
&& cmake .. -DBUILD_STATIC=ON \
&& make -j8

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

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


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

Expand Down
16 changes: 16 additions & 0 deletions docker-files/cpp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
echo "========= BUILD IMAGES for WEDPR-COMPONENT, BRANCH: ${1} ========="

echo "* build wedpr-gateway-service image"
docker build --target wedpr-gateway-service --build-arg SOURCE_BRANCH=${1} -t wedpr-gateway-service .
echo "* build wedpr-gateway-service image success"

echo "* build wedpr-pro-node-service image"
docker build --target wedpr-pro-node-service --build-arg SOURCE_BRANCH=${1} -t wedpr-pro-node-service .
echo "* build wedpr-pro-node-service image success"

echo "* build wedpr-mpc-service image"
docker build --target wedpr-mpc-service --build-arg SOURCE_BRANCH=${1} -t wedpr-mpc-service .
echo "* build wedpr-mpc-service image success"

echo "========= BUILD IMAGES for WEDPR-COMPONENT, BRANCH: ${1} ========="
34 changes: 34 additions & 0 deletions docker-files/cpp/vcpkg/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:18.04 as wedpr_component_vcpkg_cache

LABEL maintainer [email protected]

WORKDIR /

ARG SOURCE_BRANCH
ENV DEBIAN_FRONTEND=noninteractive \
SOURCE=${SOURCE_BRANCH:-master}

RUN apt-get -q update && apt-get install -qy --no-install-recommends \
vim curl git make build-essential cmake \
libgmp-dev flex bison patch libzstd-dev unzip ninja-build pkg-config curl zip tar ccache uuid-runtime automake autoconf \
m4 tcpdump net-tools libkrb5-dev krb5-user pkg-config default-libmysqlclient-dev gcc g++ \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt-get install -qy --no-install-recommends tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*

# install rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

ENV PATH="/root/.cargo/bin:${PATH}"

ENV VCPKG_FORCE_SYSTEM_BINARIES=1

# first download and compile the vcpkg dependecies
RUN git clone https://github.com/WeBankBlockchain/WeDPR-Component.git --recursive --depth=1 -b ${SOURCE} \
&& mkdir -p WeDPR-Component/cpp/build && cd WeDPR-Component/cpp/build \
&& cmake .. -DBUILD_STATIC=ON \

# move the vcpkg dependecies to /vcpkg
RUN mv /WeDPR-Component/cpp/vcpkg /

4 changes: 4 additions & 0 deletions docker-files/cpp/vcpkg/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo "* build image: wedpr_component_vcpkg_cache, branch: ${1}"
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr_component_vcpkg_cache .
echo "* build image: wedpr_component_vcpkg_cache success, branch: ${1}"
11 changes: 11 additions & 0 deletions docker-files/model/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM wedpr-image:latest as wedpr-model-service-base-image

LABEL maintainer [email protected]

RUN apt-get install -qy --no-install-recommends libkrb5-dev pkg-config default-libmysqlclient-dev
RUN mkdir -p /data/home/wedpr
# copy requirements
COPY depends/requirements.txt /data/home/wedpr/requirements.txt

# install the requirements
RUN pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ -r /data/home/wedpr/requirements.txt
4 changes: 4 additions & 0 deletions docker-files/model/base/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo "* build image: wedpr-model-service-base-image"
docker build -t wedpr-model-service-base-image .
echo "* build image: wedpr-model-service-base-image success"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM wedpr-image:latest as wedpr-model-service

FROM wedpr-model-service-base-image:latest as wedpr-model-service
LABEL maintainer [email protected]

ENV LANG zh_CN.UTF-8
Expand All @@ -9,23 +8,20 @@ ENV LC_ALL zh_CN.UTF-8
WORKDIR /data/home/wedpr
ARG SOURCE_BRANCH
ENV DEBIAN_FRONTEND=noninteractive \
SOURCE=${SOURCE_BRANCH:-master}

RUN mkdir -p /data/home/wedpr
# copy requirements
COPY depends/requirements.txt /data/home/wedpr/requirements.txt
SOURCE=${SOURCE_BRANCH:-main}

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

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

# clear the WeDPR-Component
RUN rm -rf /data/home/wedpr/WeDPR-Component
Expand Down
4 changes: 4 additions & 0 deletions docker-files/model/model/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo "* build image: wedpr-model-service, branch: ${1}"
docker build --build-arg SOURCE_BRANCH=${1} -t wedpr-model-service .
echo "* build image: wedpr-model-service success, branch: ${1}"

0 comments on commit 9e7c3f2

Please sign in to comment.