Skip to content
Snippets Groups Projects
Commit 22e3efb1 authored by Mateusz Żebrak's avatar Mateusz Żebrak
Browse files

Build dockerfile based on recently pushed .whl

parent a0e77c04
No related branches found
No related tags found
2 merge requests!204V1.27.5.1 release,!188Deploy python wheel to gitlab pypi registry
......@@ -33,7 +33,7 @@ include:
ref: fc899116bf691309cc618e51a9c2d8c6d5edb8cd #develop
file: '/scripts/ci-helpers/prepare_data_image_job.yml'
- project: 'hive/common-ci-configuration'
ref: 899a376c9b56d79000372903e75af544c90596ab # develop
ref: e619fae3c482fec7394d024f5446367adeed0852
file: '/templates/python_projects.gitlab-ci.yml'
image: ${CI_BASE_IMAGE}
......@@ -147,6 +147,8 @@ deploy_wheel:
- job: pre_commit_checks
- job: prepare_mainnet_hived_image
artifacts: true
- job: deploy_wheel
artifacts: true
when: manual
except:
- develop
......@@ -160,7 +162,15 @@ deploy_wheel:
SCRIPTS_PATH: "$CI_PROJECT_DIR/scripts"
script:
- $SCRIPTS_PATH/ci-helpers/build_instance.sh "${TAG_COMMIT}" "${CI_PROJECT_DIR}" $CI_REGISTRY_IMAGE --beekeeper-source-image=${HIVED_IMAGE_NAME} --base-image=${BASE_IMAGE} ${BUILD_INSTANCE_ARGS}
- echo "WHEEL_BUILD_VERSION is ${WHEEL_BUILD_VERSION}"
- $SCRIPTS_PATH/ci-helpers/build_instance.sh
"${TAG_COMMIT}"
"${CI_PROJECT_DIR}"
"${CI_REGISTRY_IMAGE}"
--beekeeper-source-image=${HIVED_IMAGE_NAME}
--base-image=${BASE_IMAGE}
--clive-version=${WHEEL_BUILD_VERSION}
${BUILD_INSTANCE_ARGS}
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- source docker_image_name.env
- docker push ${CLIVE_IMAGE_NAME}
......@@ -176,6 +186,8 @@ deploy_wheel:
needs:
- job: prepare_testnet_hived_image
artifacts: true
- job: deploy_wheel
artifacts: true
build_and_push_clive_image:
extends: .prepare_clive_image
......
......@@ -7,6 +7,8 @@ FROM $BEEKEEPER_IMAGE as beekeper_source
FROM $BASE_IMAGE AS instance
ARG CLIVE_VERSION
SHELL ["/bin/bash", "-c"]
ADD --chown=hived_admin:users ./docker/entrypoint.sh .
......@@ -17,8 +19,17 @@ WORKDIR /clive
ENV BEEKEEPER_PATH="/clive/beekeeper"
COPY --from=beekeper_source --chown=hived_admin:users "/home/hived/bin/beekeeper" "${BEEKEEPER_PATH}"
RUN poetry install --only main
RUN poetry dynamic-versioning # Substitute versions because of https://github.com/mtkennerly/poetry-dynamic-versioning/issues/25#issuecomment-698193152, has to be done after installation otherwise pip will show "dirty" version
RUN poetry env use python3
RUN source "$(poetry env info --path)/bin/activate"
# Project IDS:
# - 362 -> schemas
# - 392 -> clive
# - 419 -> wax
RUN pip install clive=="${CLIVE_VERSION}" \
--extra-index-url https://gitlab.syncad.com/api/v4/projects/362/packages/pypi/simple \
--extra-index-url https://gitlab.syncad.com/api/v4/projects/393/packages/pypi/simple \
--extra-index-url https://gitlab.syncad.com/api/v4/projects/419/packages/pypi/simple
# crucial for proper display
ENV COLORTERM=truecolor
......@@ -44,7 +55,6 @@ ENV COMPRESS_BLOCK_LOG_PATH="/home/hived/bin/compress_block_log"
WORKDIR /clive
# Run installation once again to supplement extras and development dependencies
RUN git restore pyproject.toml clive/__init__.py # Restore files that were modified by previous dynamic-versioning
RUN poetry install
RUN poetry dynamic-versioning # Substitute versions because of https://github.com/mtkennerly/poetry-dynamic-versioning/issues/25#issuecomment-698193152, has to be done after installation otherwise pip will show "dirty" version
......
......@@ -17,6 +17,8 @@ IMAGE_PATH_SUFFIX=""
BEEKEEPER_IMAGE=""
BASE_IMAGE=""
CLIVE_VERSION=""
DOCKER_TARGET="instance"
print_help () {
......@@ -26,6 +28,7 @@ print_help () {
echo "OPTIONS:"
echo " --beekeeper-source-image=image_name Allows to specify image name containing a prebuilt beekeper tool"
echo " --base-image=image_name Allows to specify an image name being use as a base of the one to be built"
echo " --clive-version=version Allows to specify a version of clive to be installed in the image"
echo " --embedded-testnet Allows to build a clive image having embedded a hived testnet inside (ready for immediate sanboxing run)"
echo " --image-path-suffix Allows to specify a suffix to be added to the image path, to organize images in a more structured directory-like way"
echo " --help Display this help screen and exit"
......@@ -42,6 +45,9 @@ while [ $# -gt 0 ]; do
--base-image=*)
BASE_IMAGE="${1#*=}"
;;
--clive-version=*)
CLIVE_VERSION="${1#*=}"
;;
--embedded-testnet)
DOCKER_TARGET="embedded_testnet_instance"
IMAGE_TAG_PREFIX="testnet-"
......@@ -80,6 +86,7 @@ TST_REGISTRY=${REGISTRY:?"Missing arg #3 to specify target container registry"}
TST_BEEKEEPER_IMAGE=${BEEKEEPER_IMAGE:?"Missing --beekeeper-source-image to specify beekeeper binary source"}
TST_BASE_IMAGE=${BASE_IMAGE:?"Missing --base-image option to specify base image"}
TST_CLIVE_VERSION=${CLIVE_VERSION:?"Missing --clive-version option to specify clive version"}
# Supplement a registry path by trailing slash (if needed)
[[ "${REGISTRY}" != */ ]] && REGISTRY="${REGISTRY}/"
......@@ -98,6 +105,7 @@ docker build --target=${DOCKER_TARGET} \
--build-arg CI_REGISTRY_IMAGE=$REGISTRY \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
--build-arg BEEKEEPER_IMAGE=${BEEKEEPER_IMAGE} \
--build-arg CLIVE_VERSION=${CLIVE_VERSION} \
-t ${CLIVE_IMAGE_NAME} \
-f docker/Dockerfile .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment