Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (50 loc) · 1.47 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (50 loc) · 1.47 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
# Multi-stage build for Vein RubyGems proxy server
# Stage 1: Builder
FROM rust:1.99-bookworm AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
cmake \
clang \
llvm-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Copy workspace sources
COPY Cargo.toml ./
COPY src ./src
COPY crates ./crates
COPY assets ./assets
# The registries the image serves: `gems`, `crates`, `npm` (Cargo features).
# One registry alone: --build-arg VEIN_FEATURES=tls,admin,crates
ARG VEIN_FEATURES=default
RUN if [ "$VEIN_FEATURES" = default ]; then \
cargo build --release; \
else \
cargo build --release --no-default-features --features "$VEIN_FEATURES"; \
fi
# Stage 2: Runtime
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
zlib1g \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -r -u 1000 -m vein
# Copy binary from builder
COPY --from=builder /build/target/release/vein /usr/local/bin/vein
# Set working directory and permissions
WORKDIR /data
RUN chown -R vein:vein /data
USER vein
# Expose port
EXPOSE 8346
# Container healthcheck hitting Vein's liveness endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fsS http://localhost:8346/up || exit 1
# Run vein
ENTRYPOINT ["/usr/local/bin/vein"]
CMD ["serve"]