Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainers #61

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 [email protected]
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
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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