|
| 1 | +# Stage 0: A Intel SGX SDK container |
| 2 | +FROM ubuntu:24.04 AS sgx_sdk |
| 3 | + |
| 4 | +## Install user |
| 5 | +RUN useradd -rm -d /home/ppid-tool -s /bin/bash -g root -G sudo -u 1010 ppid-tool |
| 6 | +SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
| 7 | +RUN echo 'ppid-tool:ppid-tool' | chpasswd |
| 8 | +USER ppid-tool |
| 9 | +WORKDIR /home/ppid-tool |
| 10 | + |
| 11 | +## Install SGX Dev tools |
| 12 | +USER root |
| 13 | +RUN apt-get update && apt-get upgrade -y && apt-get install -y \ |
| 14 | + gnupg \ |
| 15 | + wget \ |
| 16 | + sudo |
| 17 | + |
| 18 | +## App build time dependencies |
| 19 | +RUN apt-get update |
| 20 | +RUN apt-get install -y build-essential |
| 21 | + |
| 22 | +WORKDIR /opt/intel |
| 23 | +RUN wget https://download.01.org/intel-sgx/sgx-linux/2.25/distro/ubuntu24.04-server/sgx_linux_x64_sdk_2.25.100.3.bin |
| 24 | +RUN chmod +x sgx_linux_x64_sdk_2.25.100.3.bin |
| 25 | +RUN echo 'yes' | ./sgx_linux_x64_sdk_2.25.100.3.bin |
| 26 | + |
| 27 | +## Install SGX runtime libraries |
| 28 | +USER root |
| 29 | +RUN echo 'deb [signed-by=/etc/apt/keyrings/intel-sgx-keyring.asc arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu noble main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list |
| 30 | +RUN wget https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key |
| 31 | +RUN echo 92f96f84281031d889deb81060c44325f0481aee621ae47a15ae1df4431b4a23 intel-sgx-deb.key | sha256sum -c |
| 32 | +RUN cat intel-sgx-deb.key | sudo tee /etc/apt/keyrings/intel-sgx-keyring.asc > /dev/null |
| 33 | +RUN apt-get update |
| 34 | +RUN apt-get install -y libsgx-urts |
| 35 | + |
| 36 | +# Stage 1: Building the ppid_retrieval tool |
| 37 | +FROM sgx_sdk AS ppid_retrieval_dev |
| 38 | +USER root |
| 39 | + |
| 40 | +WORKDIR ppid-tool |
| 41 | +COPY Enclave Enclave |
| 42 | +COPY pce pce |
| 43 | +COPY main.c main.c |
| 44 | +COPY Makefile Makefile |
| 45 | + |
| 46 | +RUN source /opt/intel/sgxsdk/environment && make |
| 47 | + |
| 48 | +ENTRYPOINT bash |
| 49 | + |
| 50 | +# Stage 2: Running the ppid_retrieval tool |
| 51 | +FROM ubuntu:24.04 AS ppid_retrieval |
| 52 | + |
| 53 | +# Install Intel SGX runtime |
| 54 | +RUN apt-get update && apt-get upgrade -y && apt-get install -y wget |
| 55 | +RUN echo 'deb [signed-by=/etc/apt/keyrings/intel-sgx-keyring.asc arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu noble main' | tee /etc/apt/sources.list.d/intel-sgx.list |
| 56 | +RUN wget https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key |
| 57 | +RUN echo 92f96f84281031d889deb81060c44325f0481aee621ae47a15ae1df4431b4a23 intel-sgx-deb.key | sha256sum -c |
| 58 | +RUN cat intel-sgx-deb.key | tee /etc/apt/keyrings/intel-sgx-keyring.asc > /dev/null |
| 59 | +RUN apt-get update |
| 60 | +RUN apt-get install -y libsgx-urts |
| 61 | + |
| 62 | +# Install ppid_retrieval tool |
| 63 | +COPY --from=ppid_retrieval_dev /opt/intel/ppid-tool/ppid_retrieval /ppid_retrieval |
| 64 | +COPY --from=ppid_retrieval_dev /opt/intel/ppid-tool/pce/libsgx_pce.signed.so.1.25.100.1 /pce/libsgx_pce.signed.so.1.25.100.1 |
| 65 | +COPY --from=ppid_retrieval_dev /opt/intel/ppid-tool/Enclave/ppid.so /Enclave/ppid.so |
| 66 | + |
| 67 | +CMD ["/ppid_retrieval"] |
0 commit comments