Skip to content

Commit

Permalink
build bitacross hw worker docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
kziemianek committed May 15, 2024
1 parent 2769419 commit 98ebb35
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 5 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build_bitacross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build bitacross-worker

on: push

env:
CARGO_TERM_COLOR: always
DOCKER_BUILDKIT: 1

jobs:
build-worker:
runs-on: tee-prod-builder
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build local builder
uses: docker/build-push-action@v5
with:
context: .
file: bitacross-worker/build.Dockerfile
tags: local-builder:latest
target: builder
build-args: |
WORKER_MODE_ARG=offchain-worker
SGX_MODE=HW
ADDITIONAL_FEATURES_ARG=
IMAGE_FOR_RELEASE=true
- name: Build worker
uses: docker/build-push-action@v5
with:
context: .
file: bitacross-worker/build.Dockerfile
tags: litentry/bitacross-worker:latest
target: deployed-worker

- name: Build cli
uses: docker/build-push-action@v5
with:
context: .
file: bitacross-worker/build.Dockerfile
tags: litentry/bitacross-cli:latest
target: deployed-client

- name: Save docker images
run: docker save litentry/bitacross-worker:latest litentry/bitacross-cli:latest | gzip > bitacross-worker.tar.gz

- name: Upload docker images
uses: actions/upload-artifact@v4
with:
name: bitacross-worker
path: bitacross-worker.tar.gz
if-no-files-found: error

- name: Fail early
if: failure()
uses: andymckay/[email protected]
18 changes: 13 additions & 5 deletions bitacross-worker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,25 @@ ENV WORKER_MODE=$WORKER_MODE_ARG
ARG ADDITIONAL_FEATURES_ARG
ENV ADDITIONAL_FEATURES=$ADDITIONAL_FEATURES_ARG

ARG IMAGE_FOR_RELEASE=false
ENV IMAGE_FOR_RELEASE=$IMAGE_FOR_RELEASE

ARG FINGERPRINT=none

WORKDIR $HOME/bitacross-worker
COPY . $HOME

RUN \
rm -rf /opt/rust/registry/cache && mv /home/ubuntu/worker-cache/registry/cache /opt/rust/registry && \
rm -rf /opt/rust/registry/index && mv /home/ubuntu/worker-cache/registry/index /opt/rust/registry && \
rm -rf /opt/rust/git/db && mv /home/ubuntu/worker-cache/git/db /opt/rust/git && \
rm -rf /opt/rust/sccache && mv /home/ubuntu/worker-cache/sccache /opt/rust && \
make && sccache --show-stats
if [ "$IMAGE_FOR_RELEASE" = "true" ]; then \
echo "Omit cache for release image"; \
make; \
else \
rm -rf /opt/rust/registry/cache && mv /home/ubuntu/worker-cache/registry/cache /opt/rust/registry && \
rm -rf /opt/rust/registry/index && mv /home/ubuntu/worker-cache/registry/index /opt/rust/registry && \
rm -rf /opt/rust/git/db && mv /home/ubuntu/worker-cache/git/db /opt/rust/git && \
rm -rf /opt/rust/sccache && mv /home/ubuntu/worker-cache/sccache /opt/rust && \
make && sccache --show-stats; \
fi

RUN cargo test --release

Expand Down

0 comments on commit 98ebb35

Please sign in to comment.