-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy gateway backend as sgx (#2050)
- Loading branch information
Showing
7 changed files
with
287 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Build Stages: | ||
# build-base = downloads modules and prepares the directory for compilation. Based on the ego-dev image | ||
# build-enclave = copies over the actual source code of the project and builds it using a compiler cache | ||
# deploy = copies over only the enclave executable without the source | ||
# in a lightweight base image specialized for deployment | ||
|
||
# Final container folder structure: | ||
# /home/ten/go-ten/tools/walletextension/main contains the executable for the enclave | ||
|
||
|
||
FROM ghcr.io/edgelesssys/ego-dev:v1.5.3 AS build-base | ||
|
||
# setup container data structure | ||
RUN mkdir -p /home/ten/go-ten | ||
|
||
# Ensures container layer caching when dependencies are not changed | ||
WORKDIR /home/ten/go-ten | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN ego-go mod download | ||
|
||
|
||
# Trigger new build stage for compiling the enclave | ||
FROM build-base AS build-enclave | ||
COPY . . | ||
|
||
WORKDIR /home/ten/go-ten/tools/walletextension/main | ||
|
||
# Build the enclave using the cross image build cache. | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
ego-go build | ||
|
||
# Sign the enclave executable | ||
RUN ego sign enclave.json | ||
|
||
|
||
# Trigger a new build stage and use the smaller ego version: | ||
FROM ghcr.io/edgelesssys/ego-deploy:v1.5.3 | ||
|
||
# Copy just the binary for the enclave into this build stage | ||
COPY --from=build-enclave \ | ||
/home/ten/go-ten/tools/walletextension/main /home/ten/go-ten/tools/walletextension/main | ||
|
||
WORKDIR /home/ten/go-ten/tools/walletextension/main | ||
|
||
# simulation mode is ACTIVE by default | ||
ENV OE_SIMULATION=1 | ||
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"exe": "main", | ||
"key": "testnet.pem", | ||
"debug": true, | ||
"heapSize": 4096, | ||
"executableHeap": true, | ||
"productID": 1, | ||
"securityVersion": 1, | ||
"env": [ | ||
{ | ||
"name": "TESTMODE", | ||
"value": "false" | ||
} | ||
], | ||
"files": [ | ||
{ | ||
"source": "../storage/database/mariadb/001_init.sql", | ||
"target": "/home/ten/go-ten/tools/walletextension/storage/database/mariadb/001_init.sql" | ||
}, | ||
{ | ||
"source": "../storage/database/mariadb/002_store_incoming_txs.sql", | ||
"target": "/home/ten/go-ten/tools/walletextension/storage/database/mariadb/002_store_incoming_txs.sql" | ||
}, | ||
{ | ||
"source": "../storage/database/mariadb/003_add_signature_type.sql", | ||
"target": "/home/ten/go-ten/tools/walletextension/storage/database/mariadb/003_add_signature_type.sql" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
set -e | ||
# | ||
# This script is the entry point for starting the enclave under a Docker container. | ||
# It allows running SGX sdk using different parameters. | ||
# | ||
|
||
# It's expected to be a link between the /dev/sgx_enclave Docker device and the container /dev/sgx/enclave | ||
mkdir -p /dev/sgx | ||
if [ ! -L /dev/sgx/enclave ]; then | ||
ln -s /dev/sgx_enclave /dev/sgx/enclave | ||
fi | ||
|
||
PCCS_URL=https://global.acccache.azure.net/sgx/certification/v4/ | ||
echo "PCCS_URL: ${PCCS_URL}" | ||
|
||
apt-get install -qq libsgx-dcap-default-qpl | ||
|
||
echo "PCCS_URL=${PCCS_URL}\nUSE_SECURE_CERT=FALSE" > /etc/sgx_default_qcnl.conf | ||
|
||
"$@" |
Oops, something went wrong.