Skip to content

Commit

Permalink
Reorganize Dockerfile according to specification of standalone deploy…
Browse files Browse the repository at this point in the history
…ment (#2227)

This PR focuses on dockerfiles and the way to organize building procedures.

- Reorganized dockerfiles according to specifications of standalone deployments
- Move some CI-relevant stuff out of k8s folder and simplify them
- Clear unnecessary items in Makefile
- Make registry in FROM line configurable
- Remove unused dockerfiles (gsruntime, gsvineyard, graphscope-dev(ubuntu))
  • Loading branch information
siyuan0322 committed Nov 21, 2022
1 parent dcaa38a commit a11b453
Show file tree
Hide file tree
Showing 31 changed files with 667 additions and 977 deletions.
42 changes: 20 additions & 22 deletions .github/workflows/build-graphscope-wheels-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ on:
- "v*"

env:
DOCKER_URL: registry.cn-hongkong.aliyuncs.com
GS_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/graphscope
JUPYTER_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/jupyter
DATASET_IMAGE: registry.cn-hongkong.aliyuncs.com/graphscope/dataset
REGISTRY: registry-vpc.cn-hongkong.aliyuncs.com

jobs:
build-wheels:
Expand Down Expand Up @@ -114,12 +111,11 @@ jobs:
cd ${GITHUB_WORKSPACE}/artifacts
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
# graphscope image
cd ${GITHUB_WORKSPACE}
cd ${GITHUB_WORKSPACE}/k8s
make graphscope-image
# jupyter image
make jupyter-image
# dataset image
make dataset-image
- name: Release Nightly Image
Expand All @@ -128,20 +124,20 @@ jobs:
docker_password: ${{ secrets.DOCKER_PASSWORD }}
docker_username: ${{ secrets.DOCKER_USER }}
run: |
echo "${docker_password}" | sudo docker login --username="${docker_username}" ${{ env.DOCKER_URL }} --password-stdin
echo "${docker_password}" | sudo docker login --username="${docker_username}" ${{ env.REGISTRY }} --password-stdin
# docker tag: 0.15.0 -> 0.15.0a20220808
time=$(date "+%Y%m%d")
version=$(cat ${GITHUB_WORKSPACE}/VERSION)
tag="${version}a${time}"
# graphscope image
sudo docker tag graphscope/graphscope:${SHORT_SHA} ${{ env.GS_IMAGE }}:${tag}
sudo docker push ${{ env.GS_IMAGE }}:${tag}
sudo docker tag graphscope/graphscope:${SHORT_SHA} ${{ env.REGISTRY }}/graphscope:${tag}
sudo docker push ${{ env.REGISTRY }}/graphscope:${tag}
# jupyter image
sudo docker tag graphscope/jupyter:${SHORT_SHA} ${{ env.JUPYTER_IMAGE }}:${tag}
sudo docker push ${{ env.JUPYTER_IMAGE }}:${tag}
sudo docker tag graphscope/jupyter:${SHORT_SHA} ${{ env.REGISTRY }}/jupyter:${tag}
sudo docker push ${{ env.REGISTRY }}/jupyter:${tag}
# dataset image
sudo docker tag graphscope/dataset:${SHORT_SHA} ${{ env.DATASET_IMAGE }}:${tag}
sudo docker push ${{ env.DATASET_IMAGE }}:${tag}
sudo docker tag graphscope/dataset:${SHORT_SHA} ${{ env.REGISTRY }}/dataset:${tag}
sudo docker push ${{ env.REGISTRY }}/dataset:${tag}
- name: Extract Tag Name
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'alibaba/GraphScope' }}
Expand All @@ -154,16 +150,18 @@ jobs:
docker_password: ${{ secrets.DOCKER_PASSWORD }}
docker_username: ${{ secrets.DOCKER_USER }}
run: |
echo "${docker_password}" | sudo docker login --username="${docker_username}" ${{ env.DOCKER_URL }} --password-stdin
echo "${docker_password}" | sudo docker login --username="${docker_username}" ${{ env.REGISTRY }} --password-stdin
# graphscope image
tag=${{ steps.tag.outputs.TAG }}
# graphscope image
sudo docker tag graphscope/graphscope:${SHORT_SHA} ${{ env.GS_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker push ${{ env.GS_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker tag graphscope/graphscope:${SHORT_SHA} ${{ env.REGISTRY }}/graphscope:${tag}
sudo docker push ${{ env.REGISTRY }}/graphscope:${tag}
# jupyter image
sudo docker tag graphscope/jupyter:${SHORT_SHA} ${{ env.JUPYTER_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker push ${{ env.JUPYTER_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker tag graphscope/jupyter:${SHORT_SHA} ${{ env.REGISTRY }}/jupyter:${tag}
sudo docker push ${{ env.REGISTRY }}/jupyter:${tag}
# dataset image
sudo docker tag graphscope/dataset:${SHORT_SHA} ${{ env.DATASET_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker push ${{ env.DATASET_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker tag graphscope/dataset:${SHORT_SHA} ${{ env.REGISTRY }}/dataset:${tag}
sudo docker push ${{ env.REGISTRY }}/dataset:${tag}
ubuntu-python-test:
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'alibaba/GraphScope' }}
Expand Down
96 changes: 46 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,46 +253,6 @@ jobs:
graphscope.tar.gz
retention-days: 5

build-gie-artifacts:
# Require the user id of the self-hosted is 1001, which may need to be
# configured manually when a new self-hosted runner is added.
runs-on: [self-hosted, manylinux2014]
if: ${{ github.repository == 'alibaba/GraphScope' }}
steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cache/sccache
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build GIE Artifacts
run: |
source ~/.bashrc
cd ${GITHUB_WORKSPACE}/k8s/standalone && make artifacts-interactive-experimental RPC_TARGET=start_rpc_server_k8s
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: gie-artifacts-${{ github.sha }}
path: |
gie-artifacts.tar.gz
retention-days: 5

mini-test:
runs-on: ubuntu-20.04
if: ${{ github.repository == 'alibaba/GraphScope' }}
Expand Down Expand Up @@ -680,7 +640,6 @@ jobs:
tar -zxf ./wheel-${{ github.sha }}/client.tar.gz
tar -zxf ./wheel-${{ github.sha }}/graphscope.tar.gz
# build graphscope image
cd ${GITHUB_WORKSPACE}
make graphscope-image
docker tag graphscope/graphscope:${SHORT_SHA} ${{ env.GS_IMAGE }}:${SHORT_SHA}
Expand Down Expand Up @@ -780,9 +739,10 @@ jobs:
# Check the result file have successfully written to the given location
# hdfs dfs -test -e /ldbc_sample/res.csv_0 && hdfs dfs -test -e /ldbc_sample/res.csv_1
gie-k8s-failover-test:
needs: [build-gie-artifacts]
runs-on: [self-hosted, ubuntu2004]
build-gie-experimental:
# Require the user id of the self-hosted is 1001, which may need to be
# configured manually when a new self-hosted runner is added.
runs-on: [self-hosted, manylinux2014]
if: ${{ github.repository == 'alibaba/GraphScope' }}
steps:
- uses: actions/checkout@v3
Expand All @@ -796,24 +756,60 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cache/sccache
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build GIE Experimental Artifacts
run: |
source ~/.bashrc
export RPC_TARGET=start_rpc_server_k8s
cd interactive_engine/compiler && make build rpc.target=${RPC_TARGET}
cd ${GITHUB_WORKSPACE}
tar -czf artifacts.tar.gz interactive_engine/compiler/target/libs \
interactive_engine/compiler/target/compiler-1.0-SNAPSHOT.jar \
interactive_engine/compiler/conf \
interactive_engine/compiler/set_properties.sh \
interactive_engine/executor/ir/target/release/libir_core.so \
interactive_engine/executor/ir/target/release/${RPC_TARGET}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: gie-experimental
path: |
artifacts.tar.gz
retention-days: 5

gie-k8s-failover-test:
needs: [build-gie-experimental]
runs-on: [self-hosted, ubuntu2004]
if: ${{ github.repository == 'alibaba/GraphScope' }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: gie-experimental
path: artifacts

- name: Display structure of downloaded files
run: ls -R
working-directory: artifacts

- name: Add envs to GITHUB_ENV
run: |
short_sha=$(git rev-parse --short HEAD)
echo "SHORT_SHA=${short_sha}" >> $GITHUB_ENV
- name: Prepare Docker Image
run: |
# build gie-exp-runtime image
cd ${GITHUB_WORKSPACE}/k8s/standalone && make image-interactive-experimental-local-artifacts ARTIFACTS_DIR=artifacts/gie-artifacts-${{ github.sha }} VERSION=${SHORT_SHA}
docker build \
-t registry.cn-hongkong.aliyuncs.com/graphscope/interactive-experimental:${SHORT_SHA} \
-f .github/workflows/docker/interactive-experimental-local-artifacts.Dockerfile .
- name: Prepare Cluster and Data
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# build gie image with artifacts in local directory, skip the compile phase
############### RUNTIME: frontend && executor #######################
FROM centos:7.9.2009 AS experimental
FROM centos:7.9.2009

ARG ARTIFACTS_DIR
ADD ${ARTIFACTS_DIR}/gie-artifacts.tar.gz /opt/GraphScope/
ADD artifacts/artifacts.tar.gz /opt/GraphScope/

RUN yum install -y sudo java-1.8.0-openjdk-devel \
&& yum clean all \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
time=$(date "+%Y%m%d")
version=$(cat ${GITHUB_WORKSPACE}/VERSION)
tag="${version}a${time}"
sudo docker tag graphscope/graphscope-store:${SHORT_SHA} ${{ env.GSS_IMAGE }}:${tag}
sudo docker tag registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-store:${SHORT_SHA} ${{ env.GSS_IMAGE }}:${tag}
sudo docker push ${{ env.GSS_IMAGE }}:${tag}
- name: Extract Tag Name
Expand All @@ -61,7 +61,7 @@ jobs:
docker_username: ${{ secrets.DOCKER_USER }}
run: |
echo "${docker_password}" | sudo docker login --username="${docker_username}" ${{ env.DOCKER_URL }} --password-stdin
sudo docker tag graphscope/graphscope-store:${SHORT_SHA} ${{ env.GSS_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker tag registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-store:${SHORT_SHA} ${{ env.GSS_IMAGE }}:${{ steps.tag.outputs.TAG }}
sudo docker push ${{ env.GSS_IMAGE }}:${{ steps.tag.outputs.TAG }}
release-helm-charts:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BUILD_TEST ?= OFF
# build java sdk option
ENABLE_JAVA_SDK ?= ON

# PREFIX is environment variable, but if it is not set, then set default value
# INSTALL_PREFIX is environment variable, but if it is not set, then set default value
ifeq ($(INSTALL_PREFIX),)
INSTALL_PREFIX := /opt/graphscope
endif
Expand Down Expand Up @@ -88,6 +88,7 @@ coordinator: client
.PHONY: gae-install gie-install gle-install

gae-install: gae
mkdir -p $(INSTALL_PREFIX)
$(MAKE) -C $(GAE_BUILD_DIR) install
install $(K8S_DIR)/kube_ssh $(INSTALL_PREFIX)/bin/
install -d $(INSTALL_PREFIX)/lib/cmake/graphscope-analytical/cmake
Expand All @@ -108,6 +109,7 @@ $(GAE_BUILD_DIR)/grape_engine:
$(MAKE) -j$(NUMPROC)

gie-install: gie
mkdir -p $(INSTALL_PREFIX)
tar -xf $(GIE_DIR)/assembly/target/graphscope.tar.gz --strip-components 1 -C $(INSTALL_PREFIX)
gie: $(GIE_DIR)/assembly/target/graphscope.tar.gz

Expand All @@ -117,6 +119,7 @@ $(GIE_DIR)/assembly/target/graphscope.tar.gz:
mvn package -DskipTests -Drust.compile.mode=$(BUILD_TYPE) -P graphscope,graphscope-assembly --quiet

gle-install: gle
mkdir -p $(INSTALL_PREFIX)
$(MAKE) -C $(GLE_BUILD_DIR) install
gle: $(GLE_DIR)/built/lib/libgraphlearn_shared.$(SUFFIX)

Expand Down
39 changes: 7 additions & 32 deletions k8s/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
WORKING_DIR := $(dir $(MKFILE_PATH))
SHORT_SHA := $(shell git rev-parse --short HEAD)

ifeq ("$(DOCKER_ORG)","")
$(warning WARNING: No docker user found, using graphscope)
DOCKER_ORG = graphscope
endif

.PHONY: submodule gsruntime gsvineyard graphscope push clean
.PHONY: submodule graphscope push clean

ifeq ($(REGISTRY),)
REGISTRY := registry.cn-hongkong.aliyuncs.com
Expand Down Expand Up @@ -40,30 +35,13 @@ BUILD_PROGRESS = auto
submodule:
cd ../ && git submodule update --init

gsruntime-image:
docker build --progress=$(BUILD_PROGRESS) \
-t ${REGISTRY}/$(DOCKER_ORG)/graphscope-runtime:${VERSION} \
--network=host \
-f $(WORKING_DIR)/manylinux2014.Dockerfile .

gsvineyard-image:
docker build --progress=$(BUILD_PROGRESS) \
-t ${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VERSION} \
-f $(WORKING_DIR)/gsvineyard.Dockerfile .

graphscope-image: submodule
docker build --progress=$(BUILD_PROGRESS) \
--build-arg CI=${CI} \
-t graphscope/graphscope:${SHORT_SHA} \
--network=host \
-f $(WORKING_DIR)/graphscope.Dockerfile ..

graphscope-dev-image: submodule
docker build --progress=$(BUILD_PROGRESS) \
-t graphscope/graphscope:${SHORT_SHA} \
--network=host \
-f $(WORKING_DIR)/graphscope-dev.Dockerfile ..

jupyter-image:
docker build --progress=$(BUILD_PROGRESS) \
--build-arg CI=${CI} \
Expand All @@ -79,7 +57,6 @@ dataset-image:
-f $(WORKING_DIR)/dataset.Dockerfile ..

graphscope-store-image:
docker pull ${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VINEYARD_VERSION}
docker build --progress=$(BUILD_PROGRESS) \
--build-arg profile=${PROFILE} \
-t graphscope/graphscope-store:${SHORT_SHA} \
Expand All @@ -88,7 +65,7 @@ graphscope-store-image:

graphscope-jupyter-manylinux2014-py3:
docker run --rm -it -v $(WORKING_DIR)/..:/work \
${REGISTRY}/$(DOCKER_ORG)/graphscope-runtime:${VERSION} \
${REGISTRY}/graphscope/graphscope-dev:${VERSION} \
bash -c 'pip3 install graphscope-client -U && \
cd /work/python/jupyter/graphscope && \
python3 setup.py bdist_wheel'
Expand Down Expand Up @@ -164,9 +141,9 @@ graphscope-manylinux2014-py3-nodocker:
done

graphscope-manylinux2014-py3:
docker pull ${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VINEYARD_VERSION}
docker pull ${REGISTRY}/graphscope/graphscope-dev:${VINEYARD_VERSION}
docker run --rm -v $(WORKING_DIR)/..:/work \
${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VINEYARD_VERSION} \
${REGISTRY}/graphscope/graphscope-dev:${VINEYARD_VERSION} \
bash -c 'source ~/.bashrc && \
cd /work/k8s && \
make graphscope-manylinux2014-py3-nodocker'
Expand Down Expand Up @@ -211,15 +188,13 @@ graphscope-client-darwin-py3:
done

graphscope-client-manylinux2014-py3:
docker pull ${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VINEYARD_VERSION}
docker pull ${REGISTRY}/graphscope/graphscope-dev:${VINEYARD_VERSION}
docker run --rm -v $(WORKING_DIR)/..:/work \
${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VINEYARD_VERSION} \
${REGISTRY}/graphscope/graphscope-dev:${VINEYARD_VERSION} \
bash -c 'cd /work/k8s && make graphscope-client-manylinux2014-py3-nodocker'

push:
docker push ${REGISTRY}/$(DOCKER_ORG)/graphscope-runtime:${VERSION}
docker push ${REGISTRY}/$(DOCKER_ORG)/graphscope-vineyard:${VERSION}
docker push ${REGISTRY}/$(DOCKER_ORG)/graphscope:${VERSION}
docker push ${REGISTRY}/graphscope/graphscope:${VERSION}

clean:
docker ps -qa | xargs $(XARGS_EMPTY_FLAG) docker rm -f
Expand Down
Loading

0 comments on commit a11b453

Please sign in to comment.