Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile + add Docker build instructions #235

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Using Ubuntu 18.04 image
FROM ubuntu:18.04

USER root

# Copy the current directory contents into the container
RUN mkdir -p /mc2/opaque-sql
COPY . /mc2/opaque-sql

# Install wget
RUN apt-get update
RUN apt-get install -y wget sudo gnupg2 git
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo

# Install CMake
RUN cd /mc2 && \
wget https://github.com/Kitware/CMake/releases/download/v3.15.6/cmake-3.15.6-Linux-x86_64.sh && \
sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local

# Configure Intel and Microsoft APT repos
RUN echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu bionic main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list && \
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - && \
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main" | sudo tee /etc/apt/sources.list.d/llvm-toolchain-bionic-7.list && \
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" | sudo tee /etc/apt/sources.list.d/msprod.list && \
wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - && \
sudo apt update

# Install Intel and Open Enclave packages and dependencies
RUN sudo apt -y install clang-8 libssl-dev gdb libsgx-enclave-common libsgx-quote-ex libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave=0.12.0

# Install SBT dependencies
RUN sudo apt -y install build-essential openjdk-8-jdk python libssl-dev libmbedtls-dev

# Install Spark 3.1.1
RUN wget https://downloads.apache.org/spark/spark-3.1.1/spark-3.1.1-bin-hadoop2.7.tgz && \
tar xvf spark-3.1.1* && \
sudo mkdir -p /opt/spark && \
sudo mv spark-3.1.1*/* /opt/spark && \
rm -rf spark-3.1.1* && \
sudo mkdir -p /opt/spark/work && \
sudo chmod -R a+wx /opt/spark/work

# Set Spark environment variables in bashrc
RUN echo "" >> ~/.bashrc && \
echo "# Spark settings" >> ~/.bashrc && \
echo "export SPARK_HOME=/opt/spark" >> ~/.bashrc && \
echo "export PATH=$PATH:/opt/spark/bin:/opt/spark/sbin" >> ~/.bashrc && \
echo "" >> ~/.bashrc

# Source Open Enclave on every login
RUN echo "source /opt/openenclave/share/openenclave/openenclaverc" >> ~/.bashrc

# Set environment variables
ENV OPAQUE_HOME="/mc2/opaque-sql"
ENV OPAQUE_DATA_DIR=${OPAQUE_HOME}/data/
ENV SPARK_SCALA_VERSION=2.12
ENV SYMMETRIC_KEY_PATH=${OPAQUE_HOME}/symmetric_key.key
ENV PRIVATE_KEY_PATH=${OPAQUE_HOME}/private_key.pem
ENV MODE=SIMULATE
ENV OE_SDK_PATH=/opt/openenclave/

# Build Opaque SQL
SHELL ["/bin/bash", "-c"]
RUN cd /mc2/opaque-sql && source /opt/openenclave/share/openenclave/openenclaverc && build/sbt keys
RUN cd /mc2/opaque-sql && source /opt/openenclave/share/openenclave/openenclaverc && build/sbt package

# Set the working directory to the Opaque SQL directory
WORKDIR /mc2/opaque-sql
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,17 @@
Welcome to the landing page of Opaque SQL! Opaque SQL is a package for Apache Spark SQL that enables processing over encrypted DataFrames using the OpenEnclave framework.

### Quick start
To quickly get started with Opaque SQL, you can download our Docker image (also includes other open source projects in the MC<sup>2</sup> project).
To quickly get started with Opaque SQL, you can build a Docker container from the provided [Dockerfile](Dockerfile). To do so, you must have [Docker](https://docs.docker.com/get-docker/) installed. We recommend giving Docker at least 2 CPUs, 6 GB of memory, and 2 GB of swap space (instructions for [Mac](https://docs.docker.com/docker-for-mac/#resources), [Windows](https://docs.docker.com/docker-for-windows/#resources)). The entire Docker build process should take about 5 minutes.

```sh
docker pull mc2project/mc2
docker run -it -p 22:22 -p 50051-50055:50051-50055 -w /root mc2project/mc2
```

Change into the Opaque directory and export the Opaque and OpenEnclave environment variables.
# In the project root directory, build a Docker image `opaquesql_img` from the Dockerfile
docker build -t opaquesql_img .

```sh
cd opaque
source opaqueenv
source /opt/openenclave/share/openenclave/openenclaverc
export MODE=SIMULATE
# Run a container with Opaque SQL pre-installed
docker run -it opaquesql_img /bin/bash
```

You are now ready to run your first Opaque SQL query! First, start a Scala shell:
This will start a container with Opaque SQL pre-installed and built in simulation mode. You are now ready to run your first Opaque SQL query! First, start a Scala shell:

```sh
build/sbt console
Expand Down
33 changes: 0 additions & 33 deletions docker/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions docker/README.md

This file was deleted.