-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.27 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
# Build stage
FROM rust:trixie AS builder
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \
curl \
cmake \
build-essential \
bison \
flex \
pkg-config \
libboost-dev \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml Cargo.lock index.html ./
# Copy source code
COPY src ./src
# Build for release
# Disable lld to avoid linking issue with cg3
RUN RUSTFLAGS="-Clinker-features=-lld" cargo build --release
# Runtime stage
FROM debian:trixie-slim
# Install required packages
RUN dpkg --add-architecture amd64 && \
apt-get update && apt-get install -y \
wget \
gnupg2 \
ca-certificates \
lsb-release \
libicu76 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from builder stage
COPY --from=builder /usr/src/app/target/release/divvun-worker-grammar /usr/local/bin/divvun-worker-grammar
# Create non-root user
RUN useradd -r -u 1000 grammar
# Create data directory and set permissions
RUN mkdir -p /data && chown grammar:grammar /data
USER grammar
EXPOSE 4000
# Health check for Kubernetes and Docker
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4000/health || exit 1
ENTRYPOINT ["/usr/local/bin/divvun-worker-grammar"]