-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (52 loc) · 1.83 KB
/
Copy pathDockerfile
File metadata and controls
69 lines (52 loc) · 1.83 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
# SENTINEL Shield Docker Image
# Multi-stage build: compile with gcc, run on minimal Alpine
# ============ BUILD STAGE ============
FROM alpine:3.19 AS builder
# Install build dependencies
RUN apk add --no-cache \
build-base \
openssl-dev \
linux-headers \
pcre-dev
# Copy source
WORKDIR /build
COPY include/ ./include/
COPY src/ ./src/
COPY Makefile ./
# Build (Linux variant)
RUN make clean 2>/dev/null || true && make
# ============ RUNTIME STAGE ============
FROM alpine:3.19
# Install runtime dependencies
RUN apk add --no-cache \
libstdc++ \
openssl \
pcre
# Create non-root user
RUN addgroup -S shield && adduser -S shield -G shield
# Create directories
RUN mkdir -p /opt/shield/lib /etc/shield /var/log/shield \
&& chown -R shield:shield /opt/shield /var/log/shield
WORKDIR /opt/shield
# Copy built artifacts from builder
COPY --from=builder /build/build/libshield.so /opt/shield/lib/
COPY --from=builder /build/build/libshield.a /opt/shield/lib/
# Copy default config if exists
COPY --chmod=644 config/*.json /etc/shield/ 2>/dev/null || true
# Set library path
ENV LD_LIBRARY_PATH=/opt/shield/lib
# Switch to non-root user
USER shield
# Expose ports (API: 8080, Metrics: 9090)
EXPOSE 8080 9090
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD test -f /opt/shield/lib/libshield.so || exit 1
# Labels
LABEL org.opencontainers.image.title="SENTINEL Shield"
LABEL org.opencontainers.image.description="AI Security Shield - Enterprise LLM Protection"
LABEL org.opencontainers.image.version="1.2.0"
LABEL org.opencontainers.image.vendor="SENTINEL Project"
LABEL org.opencontainers.image.source="https://github.com/SENTINEL/shield"
# Default: library mode (no daemon, use as base image)
CMD ["echo", "SENTINEL Shield library ready. Mount your application or use as base image."]