Deploy specific github branch #67
-
With the Dockerfile # get the base image
FROM rust:1.55-slim AS build
# install build dependencies
RUN apt update \
&& apt install -y --no-install-recommends lsb-release apt-transport-https \
build-essential curl git
# prepare root project dir
WORKDIR /app
# download the target for wasm
RUN rustup target add wasm32-unknown-unknown
# install wasm-pack
RUN cargo install wasm-pack
# retrieve the src dir
RUN curl https://codeload.github.com/arctic-hen7/perseus-size-opt/tar.gz/main | tar -xz --strip=2 perseus-size-opt-main/examples/simple
# go to src dir
WORKDIR /app/simple
# install perseus-cli
RUN cargo install perseus-cli --git "https://github.com/arctic-hen7/perseus" --branch "feat-feature-gating"
# clean and prep app
RUN perseus clean && perseus prep
# specify deps in app config
RUN sed -i s'/perseus = .*/perseus = { git = "https:\/\/github.com\/arctic-hen7\/perseus", branch = "feat-feature-gating" }/' ./Cargo.toml \
&& sed -i s'/perseus-size-opt = .*/perseus-size-opt = { git = "https:\/\/github.com\/arctic-hen7\/perseus-size-opt", branch = "main" }/' ./Cargo.toml \
&& cat ./Cargo.toml
# modify lib.rs
RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs \
&& sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
&& cat ./src/lib.rs
# run plugin(s) to adjust app
RUN perseus tinker \
&& cat .perseus/Cargo.toml \
&& cat ./src/lib.rs
# deploy app
RUN perseus deploy
# prepare deployment image
FROM bitnami/minideb:buster
WORKDIR /app
COPY --from=build /app/simple/pkg /app/
ENV PERSEUS_STANDALONE=true
ENV HOST=0.0.0.0
CMD ["./server"] Docker build output ...
Step 8/19 : RUN cargo install perseus-cli --git "https://github.com/arctic-hen7/perseus" --branch "feat-feature-gating"
---> Running in c135707b175b
Updating git repository `https://github.com/arctic-hen7/perseus`
Installing perseus-cli v0.3.0-beta.13 (https://github.com/arctic-hen7/perseus?branch=feat-feature-gating#854c614f)
Updating crates.io index
Downloading crates ...
Downloaded clap v3.0.0-beta.5
Downloaded console v0.14.1
Downloaded fmterr v0.1.1
Downloaded include_dir v0.6.2
Downloaded glob v0.3.0
Downloaded include_dir_impl v0.6.2
Downloaded fs_extra v1.2.0
Downloaded anyhow v1.0.44
Downloaded textwrap v0.14.2
Downloaded number_prefix v0.4.0
Downloaded indicatif v0.17.0-beta.1
Downloaded os_str_bytes v4.2.0
Downloaded clap_derive v3.0.0-beta.5
Downloaded cargo_toml v0.9.2
Downloaded proc-macro-hack v0.5.19
Downloaded strsim v0.10.0
Compiling proc-macro2 v1.0.30
Compiling unicode-xid v0.2.2
Compiling syn v1.0.80
Compiling version_check v0.9.3
Compiling libc v0.2.105
Compiling serde v1.0.130
Compiling anyhow v1.0.44
Compiling memchr v2.4.1
Compiling proc-macro-hack v0.5.19
Compiling autocfg v1.0.1
Compiling unicode-segmentation v1.8.0
Compiling lazy_static v1.4.0
Compiling unicode-width v0.1.9
Compiling regex-syntax v0.6.25
Compiling ryu v1.0.5
Compiling serde_derive v1.0.130
Compiling once_cell v1.8.0
Compiling hashbrown v0.11.2
Compiling serde_json v1.0.68
Compiling strsim v0.10.0
Compiling number_prefix v0.4.0
Compiling glob v0.3.0
Compiling bitflags v1.3.2
Compiling itoa v0.4.8
Compiling termcolor v1.1.2
Compiling fs_extra v1.2.0
Compiling fmterr v0.1.1
Compiling proc-macro-error-attr v1.0.4
Compiling proc-macro-error v1.0.4
Compiling unicase v2.6.0
Compiling textwrap v0.14.2
Compiling heck v0.3.3
Compiling indexmap v1.7.0
Compiling regex v1.5.4
Compiling os_str_bytes v4.2.0
Compiling terminal_size v0.1.17
Compiling atty v0.2.14
Compiling quote v1.0.10
Compiling console v0.15.0
Compiling console v0.14.1
Compiling indicatif v0.17.0-beta.1
Compiling toml v0.5.8
Compiling clap_derive v3.0.0-beta.5
Compiling thiserror-impl v1.0.30
Compiling include_dir_impl v0.6.2
Compiling include_dir v0.6.2
Compiling thiserror v1.0.30
Compiling clap v3.0.0-beta.5
Compiling cargo_toml v0.9.2
Compiling perseus-cli v0.3.0-beta.13 (/usr/local/cargo/git/checkouts/perseus-7ea6a66d4aa78f48/854c614/packages/perseus-cli)
error: proc-macro derive panicked
--> packages/perseus-cli/src/prepare.rs:16:24
|
16 | const SUBCRATES: Dir = include_dir!("./.perseus");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: "/usr/local/cargo/git/checkouts/perseus-7ea6a66d4aa78f48/854c614/packages/perseus-cli/./.perseus" doesn't exist
= note: this error originates in the macro `include_dir` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find macro `proc_macro_call` in this scope
--> packages/perseus-cli/src/prepare.rs:16:24
|
16 | const SUBCRATES: Dir = include_dir!("./.perseus");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `include_dir` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `perseus-cli` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `perseus-cli v0.3.0-beta.13 (https://github.com/arctic-hen7/perseus?branch=feat-feature-gating#854c614f)`, intermediate artifacts can be found at `/tmp/cargo-installv8mhcB`
Caused by:
build failed
The command '/bin/sh -c cargo install perseus-cli --git "https://github.com/arctic-hen7/perseus" --branch "feat-feature-gating"' returned a non-zero code: 101 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Have a look at the Bonnie scripts, the repo itself is designed to be used in a self-contained manner (i.e. using its own bleeding edge version of thr CLI). Try With regards to the exact reason, installing the CLI needs the |
Beta Was this translation helpful? Give feedback.
Have a look at the Bonnie scripts, the repo itself is designed to be used in a self-contained manner (i.e. using its own bleeding edge version of thr CLI). Try
bonnie setup
and thenbonnie dev example basic deploy
. You'll then find a production-readypkg/
inexamples/basic/
. You can install Bonnie withcargo install bonnie
, and you can see the commands available for this repo withbonnie help
.With regards to the exact reason, installing the CLI needs the
.perseus/
directory to actually be inlined, which is a special part of the deployment process. I may be able to refactor it to work like this though, but that may not be possible...