stages: - prepare - compile - image - deploy cache: &global_cache key: files: - webrdp/Cargo.toml paths: - .cargo/bin - .cargo/registry/index - .cargo/registry/cache policy: pull-push variables: CARGO_HOME: ${CI_PROJECT_DIR}/.cargo APPNAME: webgateway cargo_dependencies: stage: prepare image: reg.imvictor.tech/hub/library/rust:1.72.0-slim script: - - mkdir -vp ${CARGO_HOME:-$HOME/.cargo} - echo -e '[source.crates-io]\n\nreplace-with = "mirror"\n\n[source.mirror]\nregistry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"\n' > ${CARGO_HOME:-$HOME/.cargo}/config - cargo install cargo-make wasm-pack wasm-opt - cd ./axum-websockify - cargo fetch - cd ../webrdp - cargo fetch cache: <<: *global_cache compile_websockify: stage: compile image: reg.imvictor.tech/hub/library/rust:1.72.0-slim script: - export PATH=${CI_PROJECT_DIR}/.cargo/bin:${PATH} - cargo make websockify artifacts: paths: - build/axum-websockify cache: <<: *global_cache policy: pull compile_rdp: stage: compile image: reg.imvictor.tech/hub/library/rust:1.72.0-slim script: - export PATH=${CI_PROJECT_DIR}/.cargo/bin:${PATH} - cd webrdp - export INSTALL_PATH=../build/rdp - mkdir -p ${INSTALL_PATH} - cargo make install-release - cp ../assets/* ${INSTALL_PATH}/ - cp ${INSTALL_PATH}/rdp.html ${INSTALL_PATH}/index.html artifacts: paths: - build/rdp cache: <<: *global_cache policy: pull image_prod: image: name: reg.imvictor.tech/base/imagebuilder:latest stage: image variables: IMAGE_NAME: applications/$APPNAME IMAGE_DOCKERFILE: Dockerfile.rdp script: - build-image only: - main deploy_prod: image: name: reg.imvictor.tech/base/deployer:latest stage: deploy script: - . /prepare.inc - apply projects/$APPNAME.yaml only: - main