Skip to content

Commit

Permalink
Merge pull request #10 from iosis-tech/devcontainer
Browse files Browse the repository at this point in the history
devcontainer
  • Loading branch information
Okm165 authored Apr 24, 2024
2 parents fc04875 + e50fc2b commit d8c2419
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
83 changes: 83 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 20 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -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", "${@}"]
5 changes: 2 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
@@ -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}")
Expand 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=".")

Expand Down

0 comments on commit d8c2419

Please sign in to comment.