1
0
Fork 0

fix(build): run GUI image build in correct subdir

This commit is contained in:
Sean Sube 2023-01-06 12:04:43 -06:00
parent c5794e2db7
commit 86a39680d5
2 changed files with 33 additions and 6 deletions

View File

@ -33,7 +33,7 @@ stages:
- .build-base
image: docker.io/docker:20.10
services:
- docker.io/docker-dind:20.10
- docker.io/docker:20.10-dind
allow_failure: false
before_script:
- mkdir ${HOME}/.docker
@ -51,7 +51,7 @@ stages:
IMAGE_ROOT: "${CI_PROJECT_DIR}"
VERSION_TAG: "${CI_COMMIT_REF_SLUG}"
build-js:
build-gui-js:
extends:
- .build-node
stage: build
@ -59,22 +59,26 @@ build-js:
- cd gui
- make ci
package-oci:
package-gui-oci:
extends:
- .build-dind
stage: package
needs:
- build-js
- build-gui-js
script:
- cd gui
- ${CI_PROJECT_DIR}/scripts/image-build.sh --push
variables:
IMAGE_SUFFIX: gui
package-npm:
package-gui-npm:
extends:
- .build-node
stage: package
needs:
- build-js
- build-gui-js
only:
- tags
script:
- cd gui
- npm publish

23
common/scripts/image-build.sh Executable file
View File

@ -0,0 +1,23 @@
#! /bin/bash
IMAGE_PUSH="${1:---skip}"
IMAGE_NAME="${CI_PROJECT_PATH}/${IMAGE_SUFFIX}"
IMAGE_TAG="$(echo "${CI_COMMIT_TAG:-${CI_COMMIT_REF_SLUG}}" | sed -r 's/[^-_a-zA-Z0-9\\.]/-/g')"
IMAGE_SHORT="${IMAGE_NAME}:${IMAGE_TAG}"
IMAGE_FULL="${IMAGE_NAME}:${IMAGE_TAG}"
echo "Loading last image: ${IMAGE_FULL}"
docker pull "${IMAGE_FULL}" || echo "Failed to load last image."
echo "Building image: ${IMAGE_FULL}"
docker build -f "${IMAGE_FILE}" -t "${IMAGE_FULL}" . || { echo "Failed to build image!"; exit 1; }
if [[ "${IMAGE_PUSH}" == "--push" ]];
then
echo "Pushing image: ${IMAGE_FULL}"
docker push "${IMAGE_FULL}" || { echo "Failed to push image!"; exit 1; }
fi