Skip to content
Merged
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
42 changes: 38 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ version = "0.9.0"
edition = "2024"

[dependencies]
actix-web = "4"
futures = "0.3"
futures-util = "0.3"
hex = "0.4.3"
log = "0.4"
pretty_env_logger = "0.5"
qstring = "0.7.2"
reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"] }
secp256k1 = { version = "0.31.1", features = ["global-context"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.140"
sha2 = "0.10.9"
tokio = { version = "1.48.0", features = ["rt", "macros", "rt-multi-thread"] }
url = "2"
tokio-socks = "0.5"
tokio-tungstenite = { version = "0.28", features = ["rustls-tls-native-roots"] }
urlencoding = "2.1"
uuid = { version = "1", features = ["v4"] }
actix-web = "=4.13.0"
futures = "=0.3.32"
futures-util = "=0.3.32"
hex = "=0.4.3"
log = "=0.4.29"
pretty_env_logger = "=0.5"
qstring = "=0.7.2"
reqwest = { version = "=0.13.2", default-features = false, features = ["json", "rustls", "gzip"] }
Comment thread
Gauvino marked this conversation as resolved.
secp256k1 = { version = "=0.31.1", features = ["global-context"] }
serde = { version = "=1.0.228", features = ["derive"] }
serde_json = "=1.0.149"
sha2 = "=0.10.9"
tokio = { version = "=1.50.0", features = ["rt", "macros", "rt-multi-thread"] }
url = "=2.5.8"
tokio-socks = "=0.5.2"
tokio-tungstenite = { version = "=0.28.0", features = ["rustls-tls-native-roots"] }
urlencoding = "=2.1.3"
uuid = { version = "=1.22.0", features = ["v4"] }

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
strip = true
strip = true
41 changes: 33 additions & 8 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
# Build artifacts
target/
.git/*
.github/*
docs/*
Dockerfile
compose.yml

# Git & CI
.git/
.github/
.gitignore
.devcontainer/

# Documentation
docs/
website/
README.md
README-fr.md
.dockerignore
exctractor.js
README-en.md
DISCLAIMER.md
DISCLAIMER-fr.md
SECURITY.md
LICENCE

# Docker files (not needed inside the build context)
docker/

# Nix
flake.nix
flake.lock

# Scripts & config examples
scripts/
Cross.toml
ygege.yml
ygege-en.yml
exctractor.js

# Tests
tests/
28 changes: 16 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ RUN if [ "${SKIP_UPX}" = "0" ]; then \

WORKDIR /usr/src/app

# Copy project files
# Cache Cargo dependencies separately from source code.
# This layer is only rebuilt when Cargo.toml or Cargo.lock change.
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs \
&& BUILD_COMMIT=cache BUILD_DATE=cache BUILD_BRANCH=cache \
cargo build --release \
&& rm -rf src

# Copy project files and build
COPY . .
Comment on lines +45 to 46

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e

if [ -f .dockerignore ]; then
  echo ".dockerignore found"
  echo
  sed -n '1,200p' .dockerignore
  echo
  echo "Relevant ignore rules:"
  rg -n '^(target/|\.git/|\.cargo/)' .dockerignore || true
else
  echo ".dockerignore is missing"
fi

Repository: UwUDev/ygege

Length of output: 80


Add .dockerignore to prevent build context bloat and preserve cache benefits.

The dependency-cache split requires a root .dockerignore that excludes target/, .git/, .cargo/, and other build artifacts. Without it, COPY . . will re-copy all local files on every build, invalidating the cached dependency layer and defeating the optimization.

Create .dockerignore with at least:

target/
.git/
.gitignore
.cargo/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker/Dockerfile` around lines 45 - 46, The Dockerfile's "COPY . ." step
re-copies the entire repo each build and invalidates the dependency-cache split;
add a root .dockerignore file to exclude build artifacts and VCS metadata (at
minimum include entries like target/, .git/, .gitignore, .cargo/) so the
dependency layer remains cacheable and the COPY . . step doesn't bloat the build
context.


# Build the project
Expand All @@ -56,10 +64,10 @@ ARG BUILD_DATE=unknown
ARG BUILD_BRANCH=unknown

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
adduser \
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
passwd \
Comment thread
Gauvino marked this conversation as resolved.
&& apt-get clean autoclean --yes \
Comment thread
Gauvino marked this conversation as resolved.
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
Expand All @@ -69,18 +77,14 @@ WORKDIR /app
# Copy the built binary from the build stage
COPY --from=builder /usr/src/app/target/release/ygege /app/ygege

RUN chmod +x /app/ygege

# Create necessary directories
RUN mkdir -p /app/sessions

# Create non-root user with specific UID/GID for better compatibility
# Using UID/GID 10001 to avoid conflicts with host systems
# --no-log-init: Prevents large UID values from causing issues
# --system: Creates a system user without password
# --shell /sbin/nologin: Prevents login shell access for security
RUN addgroup --gid 10001 --system ygege \
&& adduser --uid 10001 --system --ingroup ygege --home /home/ygege --shell /sbin/nologin ygege \
RUN chmod +x /app/ygege \
&& mkdir -p /app/sessions \
&& groupadd --gid 10001 --system ygege \
&& useradd --uid 10001 --system --gid ygege --home-dir /home/ygege --shell /sbin/nologin --no-log-init ygege \
&& mkdir -p /home/ygege \
&& chown -R ygege:ygege /app /home/ygege

VOLUME ["/app/sessions"]
Expand Down
Loading