Add combined dockerfile, fly config

This commit is contained in:
Riordan Panayides 2023-05-13 14:52:00 +01:00
parent 83e63c0de2
commit 28dc3c5e59
2 changed files with 42 additions and 0 deletions

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.67.1-slim AS chef
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner recipe.json recipe.json
RUN apt-get update && apt-get install -y libudev-dev clang pkg-config libssl-dev build-essential cmake
RUN rustup component add rustfmt && update-ca-certificates
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --bins
FROM debian:bullseye-slim as base_image
RUN apt-get update && apt-get -y install ca-certificates libssl1.1
# We do not need the Rust toolchain to run the binary!
FROM base_image AS runtime
COPY --from=builder /target/release/server /usr/local/bin
COPY --from=builder /target/release/worker /usr/local/bin
COPY --from=builder markets.json .
COPY --from=builder ca.cer .

18
fly.toml Normal file
View File

@ -0,0 +1,18 @@
app = "openbook-candles"
kill_signal = "SIGINT"
kill_timeout = 5
[processes]
server = "server markets.json"
worker = "worker markets.json"
[[services]]
processes = ["server"]
internal_port = 8080
protocol = "tcp"
[services.concurrency]
type = "connections"
hard_limit = 1024
soft_limit = 1024