2022-11-04 07:30:31 -07:00
|
|
|
# syntax = docker/dockerfile:1.2
|
2022-08-02 13:06:13 -07:00
|
|
|
# Base image containing all binaries, deployed to gcr.io/mango-markets/mango-v4:latest
|
2022-11-04 07:30:31 -07:00
|
|
|
FROM rust:1.60 as base
|
|
|
|
RUN cargo install cargo-chef --locked
|
|
|
|
RUN rustup component add rustfmt
|
2022-08-02 08:46:22 -07:00
|
|
|
RUN apt-get update && apt-get -y install clang cmake
|
|
|
|
WORKDIR /app
|
2022-08-02 13:06:13 -07:00
|
|
|
|
2022-11-04 07:30:31 -07:00
|
|
|
FROM base as plan
|
|
|
|
COPY . .
|
2022-08-02 08:46:22 -07:00
|
|
|
# Hack to prevent a ghost member lib/init
|
|
|
|
RUN sed -i 's|lib/\*|lib/checked_math|' Cargo.toml
|
2022-11-04 07:30:31 -07:00
|
|
|
# Hack to prevent local serum_dex manifests conflicting with cargo dependency
|
|
|
|
RUN rm -rf anchor/tests
|
|
|
|
RUN cargo chef prepare --bin keeper --recipe-path recipe-keeper.json
|
|
|
|
RUN cargo chef prepare --bin liquidator --recipe-path recipe-liquidator.json
|
2022-08-02 13:06:13 -07:00
|
|
|
|
2022-11-04 07:30:31 -07:00
|
|
|
FROM base as build
|
|
|
|
COPY --from=plan /app/recipe-*.json .
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe-keeper.json --bin keeper
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe-liquidator.json --bin liquidator
|
|
|
|
COPY . .
|
2022-11-05 06:00:04 -07:00
|
|
|
RUN cargo build --release --bin keeper --bin liquidator
|
2022-08-02 13:06:13 -07:00
|
|
|
|
2022-08-12 06:17:18 -07:00
|
|
|
FROM debian:bullseye-slim as run
|
2022-08-12 05:36:50 -07:00
|
|
|
RUN apt-get update && apt-get -y install ca-certificates libc6
|
2022-11-04 07:30:31 -07:00
|
|
|
COPY --from=build /app/target/release/keeper /usr/local/bin/
|
|
|
|
COPY --from=build /app/target/release/liquidator /usr/local/bin/
|
2022-10-26 12:25:06 -07:00
|
|
|
RUN adduser --system --group --no-create-home mangouser
|
|
|
|
USER mangouser
|