Skip to content

Commit 1d87eb8

Browse files
authored
优化Dockerfile,优化build时充分利用cache机制 (#101)
* Optimize Dockerfile * Update Dockerfile * Fixed * update * update * update * update * Update Dockerfile * Update Dockerfile * Update Dockerfile * Update Dockerfile
1 parent 94bd7d1 commit 1d87eb8

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

Dockerfile

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
FROM python:3.7-alpine
22

3-
LABEL 99kies 1290017556@qq.com https://github.com/99kies
3+
ENV USER root
44

5-
COPY . /python-sdk
5+
ENV PATH /root/.local/bin/:$PATH
6+
7+
RUN mkdir /python-sdk
8+
9+
WORKDIR /python-sdk
610

711
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
812
apk update && \
9-
apk add --no-cache gcc g++ python python-dev py-pip openssl bash linux-headers libffi-dev openssl-dev curl wget && \
10-
bash && \
11-
export PATH=/root/.local/bin/:$PATH && \
12-
cd /python-sdk && \
13-
curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/$(curl -s https://api.github.com/repos/FISCO-BCOS/FISCO-BCOS/releases | grep "\"v2\.[0-9]\.[0-9]\"" | sort -u | tail -n 1 | cut -d \" -f 4)/build_chain.sh && chmod u+x build_chain.sh && \
14-
bash build_chain.sh -l "127.0.0.1:4" -p 30300,20200,8545 && \
15-
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --user && \
16-
bash init_env.sh -i && \
13+
apk add --no-cache gcc g++ python python-dev py-pip openssl bash linux-headers libffi-dev openssl-dev curl wget
14+
15+
COPY requirements.txt /requirements.txt
16+
17+
RUN pip install -r /requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir
18+
19+
RUN curl -LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/"$(curl -s https://api.github.com/repos/FISCO-BCOS/FISCO-BCOS/releases | grep "\"v2\.[0-9]\.[0-9]\"" | sort -u | tail -n 1 | cut -d \" -f 4)"/build_chain.sh && chmod u+x build_chain.sh && \
20+
bash build_chain.sh -l "127.0.0.1:4" -p 30300,20200,8545
21+
22+
COPY . /python-sdk
23+
24+
RUN bash init_env.sh -i && \
1725
cp /python-sdk/nodes/127.0.0.1/sdk/* bin/ && \
1826
ln -s /root/.local/bin/register-python-argcomplete /bin/register-python-argcomplete && \
1927
echo "eval \"\$(register-python-argcomplete ./console.py)\"" >> ~/.bashrc && \
20-
echo "eval \"/python-sdk/nodes/127.0.0.1/start_all.sh\"" >> ~/.bashrc && \
21-
rm /var/cache/apk/*
22-
23-
WORKDIR /python-sdk
28+
echo "eval \"/python-sdk/nodes/127.0.0.1/start_all.sh\"" >> ~/.bashrc
2429

2530
EXPOSE 20200 30300 8545
2631

0 commit comments

Comments
 (0)