diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 0000000..eb5ae6e --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,10 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + "workspaceMount": "type=bind,source=${localWorkspaceFolder},destination=/workshop/sharp-p2p", + "workspaceFolder": "/workshop/sharp-p2p" +} \ No newline at end of file diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5e668cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,83 @@ +# Use a Debian-based Linux distribution as the base image +FROM --platform=linux/amd64 debian:stable-slim + +# Install necessary packages for Rust and Python development +RUN apt-get update && \ + apt-get install -y \ + curl \ + gcc \ + libc6-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust using Rustup +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + +# Add Rust binaries to the PATH +ENV PATH="/root/.cargo/bin:${PATH}" + +# Display installed Rust version +RUN rustc --version && cargo --version + +# Install cargo-make +RUN cargo install --force cargo-make + +# Install cargo-nextest +RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + +# Install dependencies for Pyenv and Python +RUN apt-get update && \ + apt-get install -y \ + make \ + build-essential \ + libssl-dev \ + zlib1g-dev \ + libbz2-dev \ + libreadline-dev \ + libsqlite3-dev \ + wget \ + curl \ + llvm \ + libncurses5-dev \ + libncursesw5-dev \ + xz-utils \ + tk-dev \ + libffi-dev \ + liblzma-dev \ + python3-openssl \ + git \ + libgmp-dev \ + libdw1 \ + && rm -rf /var/lib/apt/lists/* + +# Install Pyenv +RUN curl https://pyenv.run | bash + +RUN echo 'export PATH="/root/.pyenv/bin:$PATH"' >> /root/.bashrc && \ + echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \ + echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.bashrc + +SHELL ["/bin/bash", "-c"] + +# Set Pyenv environment variables +ENV PATH="/root/.pyenv/bin:$PATH" + +# Install Python 3.9.0 using Pyenv +RUN eval "$(pyenv init -)" && \ + eval "$(pyenv virtualenv-init -)" && \ + pyenv install 3.9.0 && \ + pyenv global 3.9.0 && \ + pyenv --version && \ + python -V && \ + pip install --upgrade pip + +# Install docker +RUN curl -fsSL https://get.docker.com | bash + +RUN mkdir -p /root/.local/bin +RUN echo 'export PATH="/root/.local/bin:$PATH"' >> /root/.bashrc + +# Set the working directory +WORKDIR /workshop + +# Set the default command to run when the container starts +CMD ["bash"] diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..3199beb --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,20 @@ +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true + +[tasks.format] +install_crate = "rustfmt" +command = "cargo" +args = ["fmt", "--", "--emit=files"] + +[tasks.clean] +command = "cargo" +args = ["clean"] + +[tasks.build] +command = "cargo" +args = ["build"] + +[tasks.test] +workspace = false +command = "cargo" +args = ["nextest", "run", "--workspace", "${@}"] diff --git a/install.py b/install.py index 3e6973d..ed24968 100644 --- a/install.py +++ b/install.py @@ -1,8 +1,8 @@ import subprocess -from colorama import Fore, Style - def log_and_run(commands, description, cwd=None): + from colorama import Fore, Style + full_command = " && ".join(commands) try: print(f"{Fore.YELLOW}Starting: {description}...{Style.RESET_ALL}") @@ -19,7 +19,6 @@ def log_and_run(commands, description, cwd=None): if __name__ == "__main__": subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True) - from colorama import Fore, Style log_and_run(["pip install cairo/"], "Install bootloader package", cwd=".")