Skip to content

Commit

Permalink
Fix deb workflow & regular workflow - split deb into separate dockerf…
Browse files Browse the repository at this point in the history
…ile, switch node.Dockerfile to 2.19-jammy instead of 2.19-bionic
  • Loading branch information
delneg committed Dec 6, 2023
1 parent 5cd5657 commit 8d23cca
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Build .deb Package Image
uses: docker/build-push-action@v4
with:
file: ./docker/node.Dockerfile
file: ./docker/deb.Dockerfile
context: .
load: true
tags: deb_build
Expand Down
69 changes: 69 additions & 0 deletions docker/deb.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
############ Install Intel SGX SDK & SGX PSW
FROM ghcr.io/sigmagmbh/sgx:2.19-bionic as base
RUN wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add -
RUN apt-get update


############ Compilation base
FROM base as compile-base

RUN apt-get install -y protobuf-compiler curl

# Install rust
ENV PATH="/usr/local/go/bin:/go/bin:/root/.cargo/bin:${PATH}"
ENV GOROOT=/usr/local/go
ENV GOPATH=/go/

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y > /dev/null 2>&1
RUN cargo install protobuf-codegen --version "2.8.1" -f

# Install golang
ADD https://go.dev/dl/go1.19.linux-amd64.tar.gz go.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf go.linux-amd64.tar.gz && rm go.linux-amd64.tar.gz
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest > /dev/null 2>&1



############ Compile enclave & chain
FROM compile-base as compile-chain

RUN apt-get install -y automake autoconf build-essential libtool git

ARG SGX_MODE=HW
ENV SGX_MODE=${SGX_MODE}
ENV SGX_SDK="/opt/intel/sgxsdk"
ENV PATH="${PATH}:${SGX_SDK}/bin:${SGX_SDK}/bin/x64"
ENV PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${SGX_SDK}/pkgconfig"
ENV LD_LIBRARY_PATH="/opt/intel/sgxsdk/sdk_libs:${LD_LIBRARY_PATH}"

COPY . /root/chain
WORKDIR /root/chain
RUN make build


############ Node binary for deb package
FROM compile-base as build-deb

ARG BUILD_VERSION="v1.0.1"
ENV VERSION=${BUILD_VERSION}
ARG DEB_BIN_DIR=/usr/local/bin
ENV DEB_BIN_DIR=${DEB_BIN_DIR}
ARG DEB_LIB_DIR=/usr/lib
ENV DEB_LIB_DIR=${DEB_LIB_DIR}
ARG ENCLAVE_HOME=${DEB_LIB_DIR}
ARG ENCLAVE_HOME=${ENCLAVE_HOME}

WORKDIR /root

# Copy over binaries from the build-env
COPY --from=compile-chain /root/chain/build/swisstronikd swisstronikd
COPY --from=compile-chain /root/.swisstronik-enclave /usr/lib/.swisstronik-enclave
COPY --from=compile-chain /root/chain/go-sgxvm/internal/api/libsgx_wrapper.x86_64.so /usr/lib/.swisstronik-enclave/libsgx_wrapper.x86_64.so

COPY ./deb ./deb
COPY ./scripts/build_deb.sh .

RUN chmod +x build_deb.sh

CMD ["/bin/bash", "build_deb.sh"]
30 changes: 1 addition & 29 deletions docker/node.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
############ Install Intel SGX SDK & SGX PSW
FROM ghcr.io/sigmagmbh/sgx:2.19-bionic as base
FROM ghcr.io/sigmagmbh/sgx:2.19-jammy as base
RUN wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add -
RUN apt-get update

Expand Down Expand Up @@ -41,34 +41,6 @@ COPY . /root/chain
WORKDIR /root/chain
RUN make build


############ Node binary for deb package
FROM compile-base as build-deb

ARG BUILD_VERSION="v1.0.1"
ENV VERSION=${BUILD_VERSION}
ARG DEB_BIN_DIR=/usr/local/bin
ENV DEB_BIN_DIR=${DEB_BIN_DIR}
ARG DEB_LIB_DIR=/usr/lib
ENV DEB_LIB_DIR=${DEB_LIB_DIR}
ARG ENCLAVE_HOME=${DEB_LIB_DIR}
ARG ENCLAVE_HOME=${ENCLAVE_HOME}

WORKDIR /root

# Copy over binaries from the build-env
COPY --from=compile-chain /root/chain/build/swisstronikd swisstronikd
COPY --from=compile-chain /root/.swisstronik-enclave /usr/lib/.swisstronik-enclave
COPY --from=compile-chain /root/chain/go-sgxvm/internal/api/libsgx_wrapper.x86_64.so /usr/lib/.swisstronik-enclave/libsgx_wrapper.x86_64.so

COPY ./deb ./deb
COPY ./scripts/build_deb.sh .

RUN chmod +x build_deb.sh

CMD ["/bin/bash", "build_deb.sh"]


############ Node binary in Hardware Mode
FROM base as hw-node

Expand Down

0 comments on commit 8d23cca

Please sign in to comment.