mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
04207e1c8f
- Use `rust-toolchain.toml` to specify tools. - Drop the unused version field from the compose files. - Use a modern Docker base for the dev-auth-webhook. - Handle signals in the test servers so `docker stop` is quick. - Upgrade Jaeger. V3_GIT_ORIGIN_REV_ID: b5fee1d5dc953a1fdb0aabd75ba02df6846b7518
71 lines
1.7 KiB
Docker
71 lines
1.7 KiB
Docker
# See https://github.com/LukeMathWalker/cargo-chef
|
|
# this should match the Rust version in rust-toolchain.yaml and the
|
|
# dev-auth-webhook
|
|
FROM rust:1.77.0 as chef
|
|
|
|
WORKDIR app
|
|
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
apt-get install --no-install-recommends --assume-yes \
|
|
lld protobuf-compiler libssl-dev ssh git pkg-config curl jq
|
|
|
|
ENV CARGO_HOME=/app/.cargo
|
|
|
|
RUN cargo install cargo-chef just grcov critcmp cargo-nextest
|
|
|
|
# Building with build.rs require git context to be available across directories
|
|
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
|
|
|
# Install standard tooling once
|
|
COPY rust-toolchain.toml .
|
|
RUN rustup show
|
|
|
|
###
|
|
# Plan recipe
|
|
FROM chef AS planner
|
|
|
|
ENV CARGO_HOME=/app/.cargo
|
|
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld"
|
|
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
###
|
|
# Build recipe
|
|
FROM chef AS builder
|
|
|
|
# Use lld
|
|
ENV CARGO_HOME=/app/.cargo
|
|
ENV PATH="$PATH:$CARGO_HOME/bin"
|
|
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld"
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
COPY --from=planner /app/.cargo/config.toml /app/.cargo/config.toml
|
|
|
|
# Build dependencies - this is the caching Docker layer!
|
|
RUN cargo chef cook --release --all-targets --recipe-path recipe.json
|
|
RUN cargo chef cook --all-targets --recipe-path recipe.json
|
|
|
|
# Copies the source after building dependencies to allow caching
|
|
COPY . .
|
|
|
|
###
|
|
# Builds the application
|
|
FROM builder AS built
|
|
# Build the app
|
|
RUN cargo build --release --all-targets
|
|
|
|
###
|
|
# Ship the app in an image with `curl` and very little else
|
|
FROM ubuntu:jammy
|
|
|
|
# Install `curl` for health checks
|
|
RUN set -ex; \
|
|
apt-get update -q; \
|
|
apt-get install -q -y curl
|
|
|
|
# Install the engine
|
|
COPY --from=built /app/target/release/engine /usr/local/bin
|
|
ENTRYPOINT ["engine"]
|