chore(ci): add gitlab ci
This commit is contained in:
parent
b5f18c8fc2
commit
ecfc9c18b4
94
.gitlab-ci.yml
Normal file
94
.gitlab-ci.yml
Normal file
@ -0,0 +1,94 @@
|
||||
stages:
|
||||
- prepare
|
||||
- compile
|
||||
- image
|
||||
- deploy
|
||||
|
||||
cache: &global_cache
|
||||
key:
|
||||
paths:
|
||||
- axum-websockify/Cargo.toml
|
||||
- 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/rust:1.72.0-slim
|
||||
script:
|
||||
- mkdir -vp ${CARGO_HOME:-$HOME/.cargo}
|
||||
- |
|
||||
cat << EOF | tee -a ${CARGO_HOME:-$HOME/.cargo}/config
|
||||
[source.crates-io]
|
||||
replace-with = 'mirror'
|
||||
|
||||
[source.mirror]
|
||||
registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"
|
||||
EOF
|
||||
- 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/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/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
|
Loading…
Reference in New Issue
Block a user