-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add fhevm coprocessor docker workflows (#105)
* chore(ci): update dockerfile var * chore(ci): add fhevm-coprocessor * chore(ci): update Dockerfile * chore(ci): pin protobuf version * chore(ci): disable generate-dev-image * chore(ci): disable hadolint * chore(ci): update Dockerfile * chore(ci): add non root user * chore(ci): add proto * chore(ci): enable hadolint * chore(ci): add docker-common to paths * chore(ci): update workflow trigger * chore(ci): restrict push to main/release
- Loading branch information
Showing
4 changed files
with
82 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "fhEVM Coprocessor Docker Image" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- amina/fhevm-coprocessor-workflows | ||
paths: | ||
- .github/workflows/fhevm-coprocessor.yml | ||
- .github/workflows/common-docker.yml | ||
- fhevm-engine/coprocessor/** | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: fhevm-coprocessor | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docker-coprocessor: | ||
uses: ./.github/workflows/common-docker.yml | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
packages: "write" | ||
with: | ||
working-directory: "." | ||
push_image: ${{ github.event_name == 'release' || github.ref_name == 'main' }} | ||
image-name: "fhevm-coprocessor" | ||
generate-dev-image: false | ||
docker-file: "fhevm-engine/coprocessor/Dockerfile" | ||
arm-build: true | ||
|
||
secrets: | ||
BLOCKCHAIN_ACTIONS_TOKEN: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }} | ||
GRAVITON_BUILDER_SSH_PRIVATE_KEY: ${{ secrets.GRAVITON_BUILDER_SSH_PRIVATE_KEY }} | ||
|
||
done: | ||
runs-on: ubuntu-latest | ||
name: Pipeline Done | ||
steps: | ||
- name: Success | ||
run: echo Pipeline Done | ||
needs: | ||
- docker-coprocessor |
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 |
---|---|---|
@@ -1,15 +1,31 @@ | ||
# Stage 1: Build | ||
FROM rust:1.82.0-bullseye AS build | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y protobuf-compiler | ||
WORKDIR /app | ||
|
||
# we assume we're in the root directory | ||
ADD . /app/ | ||
# Install dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends protobuf-compiler=3.12.4* && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN cd /app/fhevm-engine/coprocessor && SQLX_OFFLINE=true cargo build --release | ||
COPY ./fhevm-engine/ ./fhevm-engine/ | ||
COPY ./proto/ ./proto/ | ||
|
||
FROM debian:bullseye | ||
WORKDIR /app/fhevm-engine/coprocessor | ||
|
||
COPY --from=build /app/fhevm-engine/target/release/coprocessor /usr/local/bin | ||
RUN cargo fetch && \ | ||
SQLX_OFFLINE=true cargo build --release | ||
|
||
# Stage 2: Final image | ||
FROM debian:bullseye-slim | ||
|
||
RUN useradd -m zama | ||
|
||
COPY --from=build /app/fhevm-engine/target/release/coprocessor /usr/local/bin/ | ||
|
||
RUN chown zama:zama /usr/local/bin/coprocessor && \ | ||
chmod 500 /usr/local/bin/coprocessor | ||
|
||
USER zama | ||
|
||
ENTRYPOINT ["/usr/local/bin/coprocessor"] |