-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
56 lines (42 loc) · 1.55 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
# Build image.
FROM rust:1.68 AS builder
LABEL maintainer="Benjamin Bouvier <[email protected]>"
RUN mkdir -p /build/modules
COPY ./Cargo.* /build/
COPY ./src /build/src
COPY ./wit /build/wit
COPY ./modules /build/modules/
# Compile the host.
WORKDIR /build/src
RUN cargo build --release
# Set up protoc.
ENV PROTOC_ZIP=protoc-23.0-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v23.0/$PROTOC_ZIP && \
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \
chmod +x /usr/local/bin/protoc && \
rm -f $PROTOC_ZIP
ENV PROTOC=/usr/local/bin/protoc
# Install the pinned version of cargo-component.
WORKDIR /build/modules
RUN ./install-cargo-component.sh && \
rustup component add rustfmt && \
rustup target add wasm32-unknown-unknown
RUN cargo component build --release --target=wasm32-unknown-unknown
# Actual image.
FROM debian:bullseye-slim
RUN apt-get update && \
apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
update-ca-certificates && \
mkdir -p /opt/trinity/data && \
mkdir -p /opt/trinity/modules/target/wasm32-unknown-unknown/release
COPY --from=builder /build/target/release/trinity /opt/trinity/trinity
COPY --from=builder \
/build/modules/target/wasm32-unknown-unknown/release/*.wasm \
/opt/trinity/modules/target/wasm32-unknown-unknown/release
ENV MATRIX_STORE_PATH /opt/trinity/data/cache
ENV REDB_PATH /opt/trinity/data/db
VOLUME /opt/trinity/data
WORKDIR /opt/trinity
CMD /opt/trinity/trinity