Skip to content
Open
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use the official Rust image as base
FROM rust:1-slim

# Install system dependencies required by signal-backup-decode
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
libsqlite3-dev \
libssl-dev \
pkg-config \
protobuf-compiler \
git \
sudo \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install rustfmt and clippy for development
RUN rustup component add rustfmt clippy

# Create a non-root user
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

USER $USERNAME

# Set the default shell to bash
SHELL ["/bin/bash", "-c"]
63 changes: 63 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# VS Code Dev Container for Signal Backup Decode

This dev container provides a complete development environment for the signal-backup-decode project with all required dependencies pre-installed.

## Features

- **Rust toolchain**: Latest stable Rust compiler (1.75+)
- **System dependencies**:
- `libsqlite3-dev` - SQLite development libraries
- `libssl-dev` - OpenSSL development libraries
- `pkg-config` - Package configuration tool
- `protobuf-compiler` - Protocol Buffers compiler (for regenerating proto files)
- **Development tools**:
- `rustfmt` - Rust code formatter
- `clippy` - Rust linter
- **VS Code extensions**:
- Rust Analyzer - Language server for Rust
- Even Better TOML - TOML file support
- Crates - Cargo.toml dependency management

## Prerequisites

- [VS Code](https://code.visualstudio.com/)
- [Docker](https://www.docker.com/products/docker-desktop)
- [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

## Usage

1. Open this repository in VS Code
2. When prompted, click "Reopen in Container" (or run the command "Remote-Containers: Reopen in Container")
3. Wait for the container to build (first time only)
4. Once the container is ready, you can start developing!

## Building and Testing

Inside the dev container, you can use standard Cargo commands:

```bash
# Build the project
cargo build

# Run tests
cargo test

# Build with verbose output
cargo build --verbose

# Run with clippy (linter)
cargo clippy

# Format code
cargo fmt
```

## Rebuilding Protobuf Files

If you need to regenerate the protobuf files, use the `rebuild-protobuf` feature:

```bash
cargo build --features "rebuild-protobuf"
```

The `protobuf-compiler` is already installed in the container for this purpose.
20 changes: 20 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Signal Backup Decode",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml"
],
"settings": {
"rust-analyzer.checkOnSave.command": "clippy"
}
}
},
"forwardPorts": [],
"postCreateCommand": "rustc --version && cargo --version",
"remoteUser": "vscode"
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
**/*.rs.bk
Cargo.lock
*~
*~
/decoded*
Loading
Loading