CI: Build and publish #7
9
.drone.yml
Normal file
9
.drone.yml
Normal file
@ -0,0 +1,9 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: 1.81-bookworm
|
||||
commands:
|
||||
- cargo test --verbose --all
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,5 @@ target/
|
||||
pkg/
|
||||
pkg-*/
|
||||
node_modules/
|
||||
.pnpm-store
|
||||
*.local
|
||||
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM rust:1.81-bookworm
|
||||
|
||||
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
|
||||
ARG uid=1998
|
||||
ARG gid=1998
|
||||
|
||||
RUN groupadd -g "$gid" builder \
|
||||
&& useradd -u "$uid" -g "$gid" -m -d /h builder
|
||||
|
||||
USER builder
|
||||
|
||||
RUN curl -fsL https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
|
||||
RUN git config --global --add safe.directory /a
|
||||
ENV PATH="/h/.local/share/pnpm:$PATH"
|
||||
|
||||
WORKDIR /a
|
25
build.sh
Normal file
25
build.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
docker volume create umc_rust_cache
|
||||
docker volume create umc_rust_pnpm_cache
|
||||
docker volume create umc_rust_target_cache
|
||||
docker volume create umc_pnpm_loader_cache
|
||||
docker buildx build --build-arg uid="$(id -u)" --build-arg gid="$(id -g)" -t umc_rust .
|
||||
umc_rust_id="$(docker run -d -v umc_rust_cache:/h/.cargo -v "${PWD}:/a" -v umc_rust_pnpm_cache:/a/.pnpm-store -v umc_rust_target_cache:/a/target -v umc_pnpm_loader_cache:/a/um_wasm_loader/node_modules --entrypoint /usr/bin/sleep umc_rust infinity)"
|
||||
|
||||
docker exec -i -u root "${umc_rust_id}" chown "$(id -u):$(id -g)" \
|
||||
/h/.cargo \
|
||||
/a/.pnpm-store \
|
||||
/a/target \
|
||||
/a/um_wasm_loader/node_modules
|
||||
|
||||
docker exec -i "${umc_rust_id}" bash <<'EOF'
|
||||
export npm_config_use_node_version=22.9.0
|
||||
cd um_wasm_loader
|
||||
pnpm --package-import-method=copy i
|
||||
pnpm build
|
||||
pnpm pack
|
||||
EOF
|
||||
docker stop "${umc_rust_id}"
|
||||
docker rm -f "${umc_rust_id}"
|
||||
|
Loading…
Reference in New Issue
Block a user