-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile
56 lines (46 loc) · 1.43 KB
/
Dockerfile
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
# Use the Rust image based on Debian Bookworm as the base image
FROM rust:slim-bookworm as builder
# Install dependencies
RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
clang \
git \
&& rm -rf /var/lib/apt/lists/*
# Clone the repository
WORKDIR /app
RUN git clone https://github.com/sabledb-io/sabledb.git .
WORKDIR /app
# Build the project
RUN cargo build --release
# Copy the build artifact to a slim image
FROM debian:bookworm-slim
# Install necessary runtime dependencies
RUN apt-get update && apt-get install -y \
libssl-dev \
libclang-dev \
procps \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder stage
COPY --from=builder \
/app/target/release/sabledb \
/app/target/release/sabledb-benchmark \
/app/target/release/sabledb-cli \
/usr/local/bin/
RUN mkdir -p \
/var/lib/sabledb/conf \
/var/lib/sabledb/log \
/var/lib/sabledb/data \
/etc/sabledb
# Generate INI file
RUN echo '\
[general]\n\
logdir = "/var/lib/sabledb/log"\n\
public_address = "0.0.0.0:6379"\n\
db_path = "/var/lib/sabledb/data/sabledb.db"\n\
config_dir = "/var/lib/sabledb/conf"'\
>> /etc/sabledb/server.ini
# Set the entrypoint for the Docker container
ENTRYPOINT ["/usr/local/bin/sabledb", "/etc/sabledb/server.ini"]
# Expose any required ports (update this according to your project's needs)
EXPOSE 6379