-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (54 loc) · 1.93 KB
/
Dockerfile
File metadata and controls
71 lines (54 loc) · 1.93 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
# Multi-stage build for rdfless
# Build stage
FROM debian:bookworm-slim AS builder
# Install build dependencies including rustup
RUN apt-get update && apt-get install -y \
curl \
build-essential \
pkg-config \
libssl-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Rust via rustup
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Verify Rust installation
RUN rustc --version && cargo --version
# Create app directory
WORKDIR /usr/src/rdfless
# Copy dependency files first for better layer caching
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src/ ./src/
COPY tests/ ./tests/
# Build the application in release mode
RUN cargo build --release --bin rdfless
# Runtime stage - minimal Debian image
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd --create-home --shell /bin/bash rdfless
# Copy the binary from builder stage
COPY --from=builder /usr/src/rdfless/target/release/rdfless /usr/local/bin/rdfless
# Make sure the binary is executable
RUN chmod +x /usr/local/bin/rdfless
# Copy sample files for testing (optional)
COPY samples/ /opt/rdfless/samples/
# Switch to non-root user
USER rdfless
WORKDIR /home/rdfless
# Set the entrypoint
ENTRYPOINT ["rdfless"]
# Default command shows help
CMD ["--help"]
# Metadata
LABEL org.opencontainers.image.title="rdfless" \
org.opencontainers.image.description="A colorful pretty printer for RDF data with ANSI colors" \
org.opencontainers.image.version="0.4.12" \
org.opencontainers.image.authors="Lars Wilhelmsen <lars@lars-backwards.org>" \
org.opencontainers.image.url="https://github.com/larsw/rdfless" \
org.opencontainers.image.source="https://github.com/larsw/rdfless" \
org.opencontainers.image.licenses="BSD-3-Clause"