|
| 1 | +# syntax = docker/dockerfile:1.7 |
| 2 | + |
| 3 | +FROM rust:1.81.0-bookworm as builder |
| 4 | +ARG TARGETARCH |
| 5 | +ARG TARGETPLATFORM |
| 6 | + |
| 7 | +WORKDIR /app |
| 8 | + |
| 9 | +RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan git.corp.adobe.com >> ~/.ssh/known_hosts |
| 10 | + |
| 11 | +RUN <<eof |
| 12 | +#!/bin/bash |
| 13 | + apt-get update |
| 14 | + DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes wget unzip curl build-essential pkg-config openssl ca-certificates openssh-client libssl-dev protobuf-compiler patchelf python3 |
| 15 | + DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes python3.11-venv |
| 16 | + |
| 17 | + # mkdir -p /var/tmp/proto |
| 18 | + # pushd /var/tmp/proto |
| 19 | + # if [[ "${TARGETARCH}" == "amd64" ]]; then |
| 20 | + # protoc_file=protoc-26.1-linux-x86_64.zip |
| 21 | + # else |
| 22 | + # protoc_file=protoc-26.1-linux-aarch_64.zip |
| 23 | + # fi |
| 24 | + # wget https://github.com/protocolbuffers/protobuf/releases/download/v26.1/${protoc_file} |
| 25 | + # unzip ${protoc_file} |
| 26 | + # cp -a ./bin/* /usr/bin/ |
| 27 | + # cp -a ./include/* /usr/include/ |
| 28 | +eof |
| 29 | + |
| 30 | +COPY . . |
| 31 | +# on the rust image, the CARGO_HOME is set to /usr/local/cargo |
| 32 | +RUN --mount=type=cache,target=/usr/local/cargo,from=rust,source=/usr/local/cargo \ |
| 33 | + --mount=type=cache,target=/app/target \ |
| 34 | + --mount=type=ssh \ |
| 35 | +<<eof |
| 36 | +#!/bin/bash |
| 37 | +python3 -m venv venv |
| 38 | +source venv/bin/activate |
| 39 | +pip3 install -r requirements.in |
| 40 | +maturin build --release |
| 41 | +cp /app/target/wheels/*.whl /app/ |
| 42 | +eof |
| 43 | + |
| 44 | +#RUN --mount=type=cache,target=/root/.yarn \ |
| 45 | +#<<eof |
| 46 | +##!/bin/bash |
| 47 | +# export YARN_CACHE_FOLDER=/root/.yarn |
| 48 | +# pushd /app/ballista/scheduler/ui |
| 49 | +# yarnpkg install |
| 50 | +# yarnpkg build |
| 51 | +#eof |
| 52 | + |
| 53 | +FROM debian:bookworm-slim AS runtime |
| 54 | + |
| 55 | +COPY --from=builder /app/*.whl / |
| 56 | + |
| 57 | +WORKDIR /app |
| 58 | + |
| 59 | + |
0 commit comments