Skip to content

Commit

Permalink
change back to plain binary for CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyWooo committed Nov 20, 2024
1 parent 80bc20e commit f54d5ec
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 71 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -684,15 +684,6 @@ jobs:
# see https://docs.docker.com/build/drivers/
driver: docker

- name: Build local builder
if: needs.set-condition.outputs.rebuild_omni_executor == 'true'
uses: docker/build-push-action@v6
with:
context: .
file: tee-worker/omni-executor/Dockerfile
tags: local-builder:latest
target: builder

- name: Build omni-executor image
if: needs.set-condition.outputs.rebuild_omni_executor == 'true'
uses: docker/build-push-action@v6
Expand Down Expand Up @@ -1097,7 +1088,7 @@ jobs:
if: needs.set-condition.outputs.run_omni_executor_test == 'true'
timeout-minutes: 40
run: |
docker compose -f docker-compose.yml
docker compose -f docker-compose.yml up
# docker compose -f docker-compose.yml -f ${{ matrix.test_name }}.yml up --no-build --exit-code-from ${{ matrix.test_name }} ${{ matrix.test_name }}

- name: Stop integration omni executor docker containers
Expand Down
104 changes: 44 additions & 60 deletions tee-worker/omni-executor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,100 +1,84 @@
# syntax=docker/dockerfile:1

### Builder Stage
### Builder Stage - Without Gramine
##################################################
# rust:1.82 is a Debian GNU/Linux 12 (bookworm) image
FROM rust:1.82-bookworm AS builder

# It's easier to install gramine rather than to install cargo.
RUN curl -fsSLo /usr/share/keyrings/gramine-keyring.gpg https://packages.gramineproject.io/gramine-keyring.gpg
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gramine-keyring.gpg] https://packages.gramineproject.io/ bookworm main" \
| tee /etc/apt/sources.list.d/gramine.list

RUN curl -fsSLo /usr/share/keyrings/intel-sgx-deb.asc https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx-deb.asc] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" \
| tee /etc/apt/sources.list.d/intel-sgx.list

RUN apt update && apt install -y gramine

# Build
ARG SGX_MODE=SW
ENV SGX_MODE=$SGX_MODE
FROM rust:1.82-bookworm AS plain-builder

ENV HOME=/home/ubuntu
ENV BUILD_DIR=$HOME/tee-worker/omni-executor

COPY . $HOME
WORKDIR $BUILD_DIR

RUN make
RUN cargo build --release
RUN pwd
RUN ls -al $HOME
RUN ls -al $BUILD_DIR


### Base Runner Stage
### Deploy image (for CI - No Gramine)
##################################################
FROM node:20-bookworm-slim AS runner

# Install required dependencies.
# TODO: Adapt later based on CI tests requirement
RUN apt update && apt install -y libssl-dev iproute2 jq curl protobuf-compiler python3 python-is-python3 build-essential
RUN corepack enable && corepack prepare pnpm@8.7.6 --activate && corepack enable pnpm

### Deploy image (for CI - No SGX Hardware)
##################################################
FROM runner AS executor-worker
FROM node:20-bookworm-slim AS executor-worker

ENV HOME=/home/ubuntu
ENV BUILD_DIR=$HOME/tee-worker/omni-executor
ENV EXECUT_DIR=/usr/local/bin
WORKDIR $EXECUT_DIR

#TODO: Copy over any test related setup here

# It's easier to install gramine rather than to install cargo.
RUN curl -fsSLo /usr/share/keyrings/gramine-keyring.gpg https://packages.gramineproject.io/gramine-keyring.gpg
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gramine-keyring.gpg] https://packages.gramineproject.io/ bookworm main" \
| tee /etc/apt/sources.list.d/gramine.list
RUN apt update && apt install -y ca-certificates
COPY --from=plain-builder $BUILD_DIR/target/release/executor-worker $EXECUT_DIR/executor-worker

RUN curl -fsSLo /usr/share/keyrings/intel-sgx-deb.asc https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx-deb.asc] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" \
| tee /etc/apt/sources.list.d/intel-sgx.list

RUN apt update && apt install -y gramine ca-certificates && apt clean

COPY --from=local-builder:latest $BUILD_DIR/omni-executor-worker $EXECUT_DIR/omni-executor-worker
COPY --from=local-builder:latest $BUILD_DIR/omni-executor.manifest $EXECUT_DIR/omni-executor.manifest

RUN chmod +x $EXECUT_DIR/omni-executor-worker
RUN chmod +x $EXECUT_DIR/executor-worker
RUN ls -al $EXECUT_DIR
RUN ldd $EXECUT_DIR/omni-executor-worker && $EXECUT_DIR/omni-executor-worker --version
RUN ldd $EXECUT_DIR/executor-worker && $EXECUT_DIR/executor-worker --version
CMD ["$EXECUT_DIR/executor-worker"]


### Release image (with SGX Hardware)
##################################################
# FROM ubuntu:22.04 AS omni-release
# LABEL maintainer="Trust Computing GmbH <info@litentry.com>"

# ENV HOME=/home/ubuntu
# ENV BUILD_DIR=$HOME/tee-worker/omni-executor
# ENV EXECUT_DIR=/usr/local/bin
# WORKDIR $EXECUT_DIR
# ### Builder Stage - With Gramine (SGX Hardware)
# ##################################################
# # rust:1.82 is a Debian GNU/Linux 12 (bookworm) image
# FROM rust:1.82-bookworm AS sgx-builder

# # It's easier to install gramine rather than to install cargo.
# RUN curl -fsSLo /usr/share/keyrings/gramine-keyring.gpg https://packages.gramineproject.io/gramine-keyring.gpg
# RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gramine-keyring.gpg] https://packages.gramineproject.io/ jammy main" \
# RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/gramine-keyring.gpg] https://packages.gramineproject.io/ bookworm main" \
# | tee /etc/apt/sources.list.d/gramine.list

# RUN curl -fsSLo /usr/share/keyrings/intel-sgx-deb.asc https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key
# RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx-deb.asc] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" \
# | tee /etc/apt/sources.list.d/intel-sgx.list

# RUN apt update && apt install -y gramine

# # Build
# ENV HOME=/home/ubuntu
# ENV BUILD_DIR=$HOME/tee-worker/omni-executor

# COPY . $HOME
# WORKDIR $BUILD_DIR

# RUN make


# ### Release image (with SGX Hardware)
# ##################################################
# FROM gramineproject/gramine:1.8-jammy AS omni-release
# LABEL maintainer="Trust Computing GmbH <info@litentry.com>"

# ENV HOME=/home/ubuntu
# ENV BUILD_DIR=$HOME/tee-worker/omni-executor
# ENV EXECUT_DIR=/usr/local/bin
# WORKDIR $EXECUT_DIR

# RUN apt update && apt install -y gramine ca-certificates && apt clean


# COPY --from=local-builder:latest $BUILD_DIR/omni-executor-worker $EXECUT_DIR/omni-executor-worker
# COPY --from=local-builder:latest $BUILD_DIR/omni-executor.manifest $EXECUT_DIR/omni-executor.manifest
# COPY --from=local-builder:latest $BUILD_DIR/omni-executor.manifest.sgx $EXECUT_DIR/omni-executor.manifest.sgx
# COPY --from=local-builder:latest $BUILD_DIR/omni-executor.sig $EXECUT_DIR/omni-executor.sig
# COPY --from=sgx-builder $BUILD_DIR/omni-executor-worker $EXECUT_DIR/omni-executor-worker
# COPY --from=sgx-builder $BUILD_DIR/omni-executor.manifest $EXECUT_DIR/omni-executor.manifest
# COPY --from=sgx-builder $BUILD_DIR/omni-executor.manifest.sgx $EXECUT_DIR/omni-executor.manifest.sgx
# COPY --from=sgx-builder $BUILD_DIR/omni-executor.sig $EXECUT_DIR/omni-executor.sig

# RUN groupadd -g 1000 appgroup && \
# useradd -r -u 1000 -g appgroup appuser && \
Expand All @@ -105,4 +89,4 @@ CMD ["$EXECUT_DIR/executor-worker"]
# RUN chmod +x $EXECUT_DIR/omni-executor-worker
# RUN ls -al $EXECUT_DIR
# RUN ldd $EXECUT_DIR/omni-executor-worker && $EXECUT_DIR/omni-executor-worker --version
# CMD ["$EXECUT_DIR/executor-worker"]
# CMD ["$EXECUT_DIR/omni-executor-worker"]
2 changes: 1 addition & 1 deletion tee-worker/omni-executor/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
depends_on:
- ethereum-node
- litentry-node
command: ["gramine-direct", "omni-executor", "--", "ws://litentry-node:9944", "http://ethereum-node:8545", "0"]
command: ["executor-worker", "ws://litentry-node:9944", "http://ethereum-node:8545", "0"]
privileged: true
restart: always
networks:
Expand Down

0 comments on commit f54d5ec

Please sign in to comment.