-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
62 lines (45 loc) · 1.54 KB
/
Copy pathContainerfile
File metadata and controls
62 lines (45 loc) · 1.54 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
# Universal Language Connector - Containerfile
# Multi-stage build for optimal image size
# SPDX-License-Identifier: MIT OR AGPL-3.0-or-later
# Build stage - use rust:alpine for musl-based static binary
FROM rust:1.83-alpine AS builder
WORKDIR /build
# Install build dependencies (Alpine uses apk)
RUN apk add --no-cache \
musl-dev \
pkgconfig \
openssl-dev \
openssl-libs-static
# Copy manifests
COPY server/Cargo.toml server/Cargo.lock ./
# Create dummy main to cache dependencies
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src
# Copy source code
COPY server/src ./src
# Build for release with static linking
RUN cargo build --release --bin universal-connector-server
# Runtime stage - use wolfi distroless for security
FROM cgr.dev/chainguard/wolfi-base:latest
WORKDIR /app
# Install minimal runtime dependencies (wolfi uses apk)
RUN apk add --no-cache \
ca-certificates \
wget
# Copy binary from builder
COPY --from=builder /build/target/release/universal-connector-server /usr/local/bin/
# Copy web UI (optional, for serving static files)
COPY web /app/web
# Create non-root user (wolfi uses adduser)
RUN adduser -D -u 1000 connector && \
chown -R connector:connector /app
USER connector
# Expose ports
EXPOSE 8080 8081
# Health check using wget (lighter than curl)
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["sh", "-c", "wget -q --spider http://localhost:8080/api/health || exit 1"]
# Run server
CMD ["universal-connector-server"]