-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
35 lines (28 loc) · 949 Bytes
/
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
### install packages
FROM rust:1.79-slim-bullseye AS deps
WORKDIR /ic-ws-gateway
# this takes a while due to crates index update, so we do it first
RUN cargo install cargo-chef
### prepare the build
FROM deps AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
### build the IC WS Gateway
FROM deps AS builder
RUN apt update
RUN apt install -y pkg-config libssl-dev
COPY --from=planner /ic-ws-gateway/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release
### run the IC WS Gateway (we don't need the rust toolchain to run the binary)
FROM debian:bullseye-slim AS runtime
WORKDIR /ic-ws-gateway
# copy the compiled binary
COPY --from=builder /ic-ws-gateway/target/release/ic_websocket_gateway .
EXPOSE 8080
EXPOSE 9000
# run the Gateway
ENTRYPOINT ["/ic-ws-gateway/ic_websocket_gateway"]