-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 777 Bytes
/
Dockerfile
File metadata and controls
41 lines (28 loc) · 777 Bytes
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
# Build stage
FROM rust:1.70-slim-bullseye as builder
WORKDIR /usr/src/app
# Copy manifests first to leverage Docker cache
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
# Build the application
RUN cargo build --release
# Runtime stage
FROM debian:bullseye-slim
# Install necessary runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /usr/src/app/target/release/ranx .
# Copy configuration
COPY config.yaml .
# Create non-root user
RUN useradd -m -u 1000 ranx && \
chown -R ranx:ranx /app
USER ranx
# Expose the port the proxy will listen on
EXPOSE 8080
# Run the proxy
CMD ["./ranx"]