Skip to content

Commit 6f6784f

Browse files
feat: #4759 venus : add docker feature (#4873)
* add: docker dir and dockerfile * add: github action to release docker * fix: defuat check out docker branch * fix: dockerfile name not fit the one action refoer * fix: build-env needed * rm: docker with time tag * add: docker-compose * fix:default pull run & buildenv from dockerhub * add:enable push runtime and buildenv to dockerhub * fix: nettype judge err * fix:log more readable * add: vim,telnet to runtime * feat:add docker publish to main branch * fix:syntax error in action * fix: rm docker-compose file * fix: change action trigger to making tag * chore: rm the test workflow of docker * style:add reture to the end of file * fix: change comment in to English Co-authored-by: diwufeiwen <1033935631@qq.com>
1 parent 19620ae commit 6f6784f

File tree

6 files changed

+99
-2
lines changed

6 files changed

+99
-2
lines changed

.github/workflows/tag-workflow.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,17 @@ jobs:
171171
--data-urlencode "link=$link" \
172172
--data-urlencode "description=message:${{steps.vars.outputs.git_message}}, branch:${{steps.vars.outputs.branch}}, commit:${{steps.vars.outputs.short}}, tag:${{steps.vars.outputs.github_tag}}" \
173173
--data-urlencode "version=${{steps.vars.outputs.short}}"
174-
set -e
174+
set -e
175+
176+
- name: Publish the Docker image
177+
if: ${{ github.ref_type == 'tag' && github.event_name == 'create' }}
178+
run: |
179+
make docker-buildenv
180+
make docker-runtime
181+
docker build . --file dockerfile --tag filvenus/venus:latest
182+
docker tag filvenus/venus:latest filvenus/venus:${{steps.vars.outputs.github_tag}}
183+
docker login --username=filvenus --password ${{ secrets.DOCKER_PASSWORD }}
184+
docker push filvenus/venus:${{steps.vars.outputs.github_tag}}
185+
docker push filvenus/venus:latest
186+
docker push filvenus/venus-runtime:latest
187+
docker push filvenus/venus-buildenv:latest

Makefile

+16-1
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,19 @@ dist-clean:
112112

113113
build: $(BUILD_DEPS)
114114
rm -f venus
115-
go build -o ./venus $(GOFLAGS) .
115+
go build -o ./venus $(GOFLAGS) .
116+
117+
118+
119+
120+
.PHONY: docker
121+
122+
BUILD_DOCKER_PROXY=
123+
docker-buildenv:
124+
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t filvenus/venus-buildenv -f docker/venus-buildenv.dockerfile .
125+
126+
docker-runtime:
127+
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t filvenus/venus-runtime -f docker/venus-runtime.dockerfile .
128+
129+
docker:
130+
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t venus .

docker/script/compose.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
echo $@
4+
5+
if [ $nettype = "calibnet" ];then
6+
nettype="cali"
7+
fi
8+
9+
echo "nettype:"
10+
echo $nettype
11+
./venus daemon --network=${nettype} --auth-url=http://127.0.0.1:8989 --import-snapshot /snapshot.car

docker/venus-buildenv.dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# build container stage
2+
FROM golang:1.16.5 AS build-env
3+
4+
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
5+
6+
7+
# download dependence
8+
RUN apt-get update -y
9+
RUN apt-get install -y \
10+
mesa-opencl-icd ocl-icd-opencl-dev bzr jq pkg-config hwloc libhwloc-dev
11+
RUN apt-get install -y \
12+
gcc clang build-essential
13+
RUN apt-get install -y \
14+
make ncftp git curl wget

docker/venus-runtime.dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:20.04
2+
3+
# install dependence
4+
RUN apt-get -qq update \
5+
&& apt-get -qq install -y --no-install-recommends ca-certificates curl vim telnet
6+
7+
# set time zone to Shanghai
8+
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
9+
RUN echo 'Asia/Shanghai' >/etc/timezone
10+
11+
# set charset
12+
ENV LANG C.UTF-8

dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM filvenus/venus-buildenv AS buildenv
2+
3+
RUN git clone https://github.com/filecoin-project/venus.git --depth 1
4+
RUN export GOPROXY=https://goproxy.cn && cd venus && make
5+
RUN cd venus && ldd ./venus
6+
7+
8+
FROM filvenus/venus-runtime
9+
10+
# DIR for app
11+
WORKDIR /app
12+
13+
# copy the app from build env
14+
COPY --from=buildenv /go/venus/venus /app/venus
15+
COPY ./docker/script /script
16+
17+
# copy ddl
18+
COPY --from=buildenv /usr/lib/x86_64-linux-gnu/libhwloc.so.5 \
19+
/usr/lib/x86_64-linux-gnu/libOpenCL.so.1 \
20+
/lib/x86_64-linux-gnu/libgcc_s.so.1 \
21+
/lib/x86_64-linux-gnu/libutil.so.1 \
22+
/lib/x86_64-linux-gnu/librt.so.1 \
23+
/lib/x86_64-linux-gnu/libpthread.so.0 \
24+
/lib/x86_64-linux-gnu/libm.so.6 \
25+
/lib/x86_64-linux-gnu/libdl.so.2 \
26+
/lib/x86_64-linux-gnu/libc.so.6 \
27+
/usr/lib/x86_64-linux-gnu/libnuma.so.1 \
28+
/usr/lib/x86_64-linux-gnu/libltdl.so.7 \
29+
/lib/
30+
31+
EXPOSE 3453
32+
ENTRYPOINT ["/app/venus","daemon"]

0 commit comments

Comments
 (0)