Skip to content

Commit

Permalink
check with another file
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Trofimov committed Jan 25, 2024
1 parent 1a99600 commit 5f0e84c
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/create-release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ jobs:
WORKER_DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/.*\(w.*\)/\1/;s/w/v/')
echo "WORKER_DOCKER_TAG=$WORKER_DOCKER_TAG" >> $GITHUB_ENV
- name: Free up disk space
if: startsWith(runner.name, 'GitHub Actions')
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
swap-storage: false
large-packages: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
Expand All @@ -193,7 +201,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: tee-worker/build.Dockerfile
file: tee-worker/build-release.Dockerfile
tags: local-builder:latest
target: builder
build-args: |
Expand All @@ -204,15 +212,15 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: tee-worker/build.Dockerfile
file: tee-worker/build-release.Dockerfile
tags: litentry/litentry-worker:${{ env.WORKER_DOCKER_TAG }}
target: deployed-worker

- name: Build cli
uses: docker/build-push-action@v5
with:
context: .
file: tee-worker/build.Dockerfile
file: tee-worker/build-release.Dockerfile
tags: litentry/litentry-cli:${{ env.WORKER_DOCKER_TAG }}
target: deployed-client

Expand Down
115 changes: 115 additions & 0 deletions tee-worker/build-release.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# syntax=docker/dockerfile:1
# Copyright 2021 Integritee AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This is a multi-stage docker file, where the first stage is used
# for building and the second deploys the built application.

### Builder Stage
##################################################
FROM litentry/litentry-tee-dev:latest AS builder
LABEL maintainer="Trust Computing GmbH <[email protected]>"

# set environment variables
ENV SGX_SDK /opt/sgxsdk
ENV PATH "$PATH:${SGX_SDK}/bin:${SGX_SDK}/bin/x64:/opt/rust/bin"
ENV PKG_CONFIG_PATH "${PKG_CONFIG_PATH}:${SGX_SDK}/pkgconfig"
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:${SGX_SDK}/sdk_libs"
ENV CARGO_NET_GIT_FETCH_WITH_CLI true

ENV SCCACHE_CACHE_SIZE="20G"
ENV SCCACHE_DIR="/opt/rust/sccache"
ENV RUSTC_WRAPPER="/opt/rust/bin/sccache"

# Default SGX MODE is software mode
ARG SGX_MODE=SW
ENV SGX_MODE=$SGX_MODE

ARG SGX_PRODUCTION=0
ENV SGX_PRODUCTION=$SGX_PRODUCTION

ENV HOME=/home/ubuntu

ARG WORKER_MODE_ARG
ENV WORKER_MODE=$WORKER_MODE_ARG

ARG ADDITIONAL_FEATURES_ARG
ENV ADDITIONAL_FEATURES=$ADDITIONAL_FEATURES_ARG

ARG FINGERPRINT=none

WORKDIR $HOME/tee-worker
COPY . $HOME

RUN make
RUN cargo test --release


### Base Runner Stage
##################################################
FROM node:18-bookworm-slim AS runner

RUN apt update && apt install -y libssl-dev iproute2 jq curl
RUN corepack enable && corepack prepare [email protected] --activate && corepack enable pnpm


### Deployed CLI client
##################################################
FROM runner AS deployed-client
LABEL maintainer="Trust Computing GmbH <[email protected]>"

ARG SCRIPT_DIR=/usr/local/worker-cli
ARG LOG_DIR=/usr/local/log

ENV SCRIPT_DIR ${SCRIPT_DIR}
ENV LOG_DIR ${LOG_DIR}

RUN mv /home/ubuntu/tee-worker/bin/litentry-cli /usr/local/bin
RUN mv /home/ubuntu/tee-worker/cli/*.sh /usr/local/worker-cli/

RUN chmod +x /usr/local/bin/litentry-cli ${SCRIPT_DIR}/*.sh
RUN mkdir ${LOG_DIR}

RUN ldd /usr/local/bin/litentry-cli && /usr/local/bin/litentry-cli --version

ENTRYPOINT ["/usr/local/bin/litentry-cli"]


### Deployed worker service
##################################################
FROM runner AS deployed-worker
LABEL maintainer="Trust Computing GmbH <[email protected]>"

WORKDIR /usr/local/bin

RUN mv /opt/sgxsdk /opt/sgxsdk
RUN mv /home/ubuntu/tee-worker/bin/* /usr/local/bin
RUN mv /home/ubuntu/tee-worker/cli/*.sh /usr/local/worker-cli/
RUN mv /lib/x86_64-linux-gnu/libsgx* /lib/x86_64-linux-gnu/
RUN mv /lib/x86_64-linux-gnu/libdcap* /lib/x86_64-linux-gnu/

RUN touch spid.txt key.txt
RUN chmod +x /usr/local/bin/litentry-worker
RUN ls -al /usr/local/bin

# checks
ENV SGX_SDK /opt/sgxsdk
ENV SGX_ENCLAVE_SIGNER $SGX_SDK/bin/x64/sgx_sign
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/sgx-aesm-service/aesm:$SGX_SDK/sdk_libs
ENV AESM_PATH=/opt/intel/sgx-aesm-service/aesm

RUN ldd /usr/local/bin/litentry-worker && /usr/local/bin/litentry-worker --version

# TODO: use entrypoint and aesm service launch, see P-295 too
ENTRYPOINT ["/usr/local/bin/litentry-worker"]

0 comments on commit 5f0e84c

Please sign in to comment.