-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (50 loc) · 1.61 KB
/
Copy pathDockerfile
File metadata and controls
69 lines (50 loc) · 1.61 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
# Build stage
# Use bookworm to match runtime glibc version
FROM rust:bookworm AS builder
# Install build dependencies for aws-lc-sys (rustls backend)
RUN apt-get update && apt-get install -y \
cmake \
clang \
libclang-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy manifests first for better layer caching
COPY Cargo.toml Cargo.lock ./
# Create dummy files to satisfy Cargo.toml references
RUN mkdir -p src tests && \
echo "fn main() {}" > src/main.rs && \
echo "fn main() {}" > tests/cucumber.rs && \
echo "fn main() {}" > tests/integration_cucumber.rs
# Build dependencies only
RUN cargo build --release && rm -rf src tests
# Copy actual source code
COPY src ./src
# Create dummy test files (not needed for binary, but Cargo checks them)
RUN mkdir -p tests && \
echo "fn main() {}" > tests/cucumber.rs && \
echo "fn main() {}" > tests/integration_cucumber.rs
# Touch main.rs to trigger rebuild
RUN touch src/main.rs
# Build the actual binary
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies (CA certificates for HTTPS)
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -r -s /bin/false vixy
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/target/release/vixy /app/vixy
# Copy example config
COPY config.example.toml /app/config.example.toml
# Set ownership
RUN chown -R vixy:vixy /app
USER vixy
# Default port
EXPOSE 8080
# Default command
ENTRYPOINT ["/app/vixy"]
CMD ["--config", "/app/config.toml", "--listen", "0.0.0.0:8080"]