# syntax=docker/dockerfile:1.3

# Copyright (c) 2023 by Alibaba.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

ARG BASE_IMAGE=debian:stable-slim

FROM ${BASE_IMAGE} AS builder

WORKDIR /usr/src/rvps

COPY . .

RUN apt update && apt install -y protobuf-compiler git libudev-dev curl make gcc openssl libssl-dev clang openssh-client pkg-config

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup component add rustfmt clippy

RUN cargo install --bin rvps --path rvps

FROM ${BASE_IMAGE}

RUN apt update && apt install -y openssl curl pkg-config

COPY --from=builder /root/.cargo/bin/rvps /usr/local/bin/rvps

CMD ["rvps"]

VOLUME /opt/confidential-containers/attestation-service/reference_values/

EXPOSE 50003