-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (58 loc) · 2.03 KB
/
Dockerfile
File metadata and controls
73 lines (58 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Build stage for the Rust server
FROM rust:1.94.1-slim-bookworm AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
curl \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy workspace files (use Docker-specific Cargo.toml with minimal workspace)
COPY Cargo.docker.toml ./Cargo.toml
COPY Cargo.lock ./
COPY rustatio-core ./rustatio-core
COPY rustatio-server ./rustatio-server
COPY rustatio-watch ./rustatio-watch
# Copy the pre-built UI
COPY ui/dist ./ui/dist
# Build the server with embedded UI
RUN cargo build --release -p rustatio-server
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
gosu \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user (will be modified at runtime via PUID/PGID)
RUN groupadd -g 1000 rustatio && useradd -u 1000 -g rustatio rustatio
WORKDIR /app
# Copy the built binary and entrypoint
COPY --from=builder /app/target/release/rustatio-server /app/rustatio-server
COPY scripts/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Create data directory and set permissions
RUN mkdir -p /data && chown -R rustatio:rustatio /app /data
# Set environment variables (can be overridden at runtime)
ENV PORT=8080
ENV RUST_LOG=info
ENV DATA_DIR=/data
# Watch folder is auto-detected: enabled only if WATCH_DIR exists (mounted volume)
ENV WATCH_DIR=/torrents
# WATCH_ENABLED is intentionally unset to enable auto-detection
ENV WATCH_AUTO_START=false
# PUID/PGID for permission handling (LinuxServer.io style)
# Override these to match your host user's UID/GID for mounted volumes
ENV PUID=1000
ENV PGID=1000
# Expose default port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f "http://localhost:${PORT}/health" || exit 1
# Use entrypoint for PUID/PGID handling
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/rustatio-server"]