-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (44 loc) · 1.49 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
### Build
FROM docker.io/library/debian:bookworm AS builder
# Install Debian build dependencies
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
ca-certificates \
curl \
git \
lsb-release \
patchutils \
unzip \
libclang-dev \
--no-install-recommends
# Install rustup, use nightly. crsqlite needs nightly.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
ENV PATH="/root/.cargo/bin:${PATH}"
# Install serde tooling, needed by veilid-core dependency during build
WORKDIR /src
COPY scripts/ scripts/
RUN bash -xe scripts/install_capnproto.sh
RUN bash -xe scripts/install_protoc.sh
# Cache ddcp crate dependencies
WORKDIR /src
RUN mkdir -p src/bin
RUN echo 'fn main() {panic!("placeholder")}' > src/lib.rs
RUN echo 'fn main() {panic!("placeholder")}' > src/bin/main.rs
RUN echo 'fn main() {}' > build.rs
COPY ["Cargo.toml", "Cargo.lock", "./"]
RUN cargo build --release
# Build ddcp
COPY . .
RUN touch src/lib.rs src/bin/main.rs build.rs
RUN cargo build --release
### Runtime
FROM debian:bookworm-slim
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y sqlite3
COPY --from=builder /src/target/release/ddcp /usr/bin/ddcp
COPY --from=builder /src/target/release/crsqlite.so /usr/lib/crsqlite.so
ENV DB_FILE /data/db
ENV STATE_DIR /data/state
ENV EXT_FILE /usr/lib/crsqlite.so
VOLUME /data
ENTRYPOINT ["/usr/bin/ddcp"]