forked from fr3ddy-fryd3/postgrust-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 776 Bytes
/
Dockerfile
File metadata and controls
42 lines (29 loc) · 776 Bytes
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
# Multi-stage build for RustDB
# Stage 1: Builder
FROM rust:1-slim-bookworm as builder
WORKDIR /app
# Copy manifests
COPY Cargo.toml Cargo.lock ./
# Copy source code
COPY src ./src
COPY examples ./examples
# Build release binary
RUN cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 rustdb
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/target/release/postgrustql /app/postgrustql
# Create data directory
RUN mkdir -p /app/data && chown -R rustdb:rustdb /app
USER rustdb
# Expose PostgreSQL default port
EXPOSE 5432
# Run the server
CMD ["./postgrustql"]