diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..2589d4f5 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,46 @@ +FROM debian:bookworm + +RUN apt update && apt install -y curl wget git build-essential pkg-config libssl-dev + +#################### Installation #################### +#Earthly +ENV EARTHLY_VERSION="v0.8.15" +ENV EARTHLY_RELEASE="https://github.com/earthly/earthly/releases/download/${EARTHLY_VERSION}/earthly-linux-amd64" +RUN wget ${EARTHLY_RELEASE} -O /usr/local/bin/earthly \ + && chmod +x /usr/local/bin/earthly \ + && /usr/local/bin/earthly bootstrap --with-autocomplete + +#Rust +ENV PATH="/root/.cargo/bin:${PATH}" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +RUN rustup target add x86_64-unknown-linux-gnu + +# Sccache (cargo is too slow) +#RUN cargo install sccache@0.8.1 +ENV RUSTC_WRAPPER=sccache +RUN wget https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz \ + && tar xzf sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz \ + && mv sccache-v0.8.1-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache \ + && chmod +x /usr/local/bin/sccache + +# Node.js and npm (with nvm) +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash +ENV NVM_DIR="/root/.nvm" +ENV NODE_VERSION="22.8.0" +RUN . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +# Install cargo-chef +RUN cargo install cargo-chef --locked + +################ Setup ################ +#ENV META_PROJECT_DIR=/meta-secret +#WORKDIR ${META_PROJECT_DIR} +# Cache dependencies with cargo chef +#COPY recipe.json ${META_PROJECT_DIR} +#RUN cargo chef cook --release --target x86_64-unknown-linux-gnu --recipe-path recipe.json + +#RUN cd wasm && wasm-pack build --target web diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..9c848e38 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "name": "MetaSecret", + + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + + workspaceFolder: "/meta-secret", + workspaceMount: "source=${localWorkspaceFolder},target=/meta-secret,type=bind,consistency=cached", + + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + } +} \ No newline at end of file diff --git a/Earthfile b/Earthfile index 6094f16a..cfd2fe9c 100644 --- a/Earthfile +++ b/Earthfile @@ -8,7 +8,7 @@ generate-cargo-chef-recipe: SAVE ARTIFACT recipe.json AS LOCAL recipe.json base-build: - FROM rust:1.80.1 + FROM rust:1.81.0-bookworm RUN rustup component add rustfmt diff --git a/core/Cargo.toml b/core/Cargo.toml index 8b83c97d..4fdf19c8 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -16,6 +16,9 @@ test_utils = [] crate-type = ["cdylib", "lib", "staticlib"] name = "meta_secret_core" +[build] +target = "x86_64-unknown-linux-gnu" + [dependencies] thiserror.workspace = true anyhow.workspace = true