Skip to content

[BUG] Dockerfile fails to build: outdated Rust version + missing SQLx offline cache #5

@qdpops

Description

@qdpops

[BUG] docker-compose up fails to build — multiple errors

Errors

1. Cargo.lock version mismatch (rust:1.75)

error: lock file version `4` was found, but this version of Cargo does not understand this lock file

2. edition2024 not stabilized (rust:1.82)

error: feature `edition2024` is required
  home-0.5.12 requires the Cargo feature called `edition2024`,
  not stabilized in Cargo 1.82.0

3. ICU crates require rustc 1.86 (rust:1.85)

error: rustc 1.85.1 is not supported by the following packages:
  icu_collections@2.2.0 requires rustc 1.86
  icu_normalizer@2.2.0 requires rustc 1.86
  idna_adapter@1.2.2 requires rustc 1.86
  ...

4. SQLx compile-time query check fails (rust:1.86)

error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare`
  --> crates/tunnel/src/load_balancer.rs:107:9
  |
  |         sqlx::query!(
  |             "UPDATE users SET nameserver_id = ?, updated_at = ? WHERE id = ?",

No DATABASE_URL, no .sqlx/ cache, no migration files in the repo.

5. LoadBalancerRecommendation and NameserverInfo missing Serialize

error[E0277]: the trait bound `LoadBalancerRecommendation: serde::Serialize` is not satisfied
  --> crates/server/src/routes/nameservers.rs:280:13

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `serde`
  --> crates/tunnel/src/balancer.rs:2:24

Both structs are serialized into JSON API responses but have no #[derive(Serialize)], and serde is not in crates/tunnel/Cargo.toml.


Fix

Dockerfile — replace rust:1.75 with rust:1.86, add SQLx cache generation step:

FROM rust:1.86 AS builder
WORKDIR /app

RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/*
RUN cargo install sqlx-cli --no-default-features --features sqlite --quiet

COPY Cargo.toml Cargo.lock ./
COPY crates ./crates

RUN sqlite3 /tmp/build.db "\
    CREATE TABLE nameservers (\
        id INTEGER PRIMARY KEY, domain TEXT NOT NULL, public_key TEXT NOT NULL,\
        assigned_users INTEGER NOT NULL DEFAULT 0, max_users INTEGER NOT NULL DEFAULT 100,\
        is_healthy INTEGER NOT NULL DEFAULT 1, priority INTEGER NOT NULL DEFAULT 0,\
        created_at INTEGER NOT NULL DEFAULT 0, is_active INTEGER NOT NULL DEFAULT 1\
    );\
    CREATE TABLE users (id INTEGER PRIMARY KEY, nameserver_id INTEGER, updated_at INTEGER);"

RUN DATABASE_URL="sqlite:/tmp/build.db" cargo sqlx prepare --workspace -- --lib || \
    DATABASE_URL="sqlite:/tmp/build.db" cargo sqlx prepare -- --lib

RUN SQLX_OFFLINE=true cargo build --release -p server

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates sqlite3 curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/slipstream-panel /usr/local/bin/
RUN mkdir -p /data
EXPOSE 8080/tcp 53/udp 2222/tcp
ENTRYPOINT ["slipstream-panel"]

crates/tunnel/src/balancer.rs — add serde::Serialize to both structs:

#[derive(Debug, Clone, serde::Serialize)]
pub struct NameserverInfo { ... }

#[derive(Debug, Clone, serde::Serialize)]
pub struct LoadBalancerRecommendation { ... }

crates/tunnel/Cargo.toml — add serde dependency:

[dependencies]
serde = { workspace = true, features = ["derive"] }

.gitignore — remove Cargo.lock so builds are reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions