-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tweak build * build Docker image * ci build Docker image * format dockerfile --------- Co-authored-by: Timofey Luin <timofey.luin@gmail.com>
- Loading branch information
Showing
2 changed files
with
79 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
name: Spectre Deploy | ||
# The Licensed Work is (c) 2022 Sygma | ||
# SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
name: Spectre Testnet | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- docker-friendly | ||
tags: | ||
- 'v*.*.*' | ||
|
||
env: | ||
REGISTRY: 'ghcr.io' | ||
TAG: 'latest' | ||
|
||
jobs: | ||
deploy: | ||
push: | ||
name: push | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: checkout the source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: initialize all submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: deployments | ||
uses: burnett01/rsync-deployments@6.0.0 | ||
with: | ||
switches: -avzr --delete --exclude '.git' | ||
path: ./ | ||
remote_path: /home/ubuntu/Spectre | ||
remote_host: ${{ secrets.ACTIONS_HOST }} | ||
remote_user: ${{ secrets.ACTIONS_USER }} | ||
remote_key: ${{ secrets.ACTIONS_CONNECTIONS }} | ||
|
||
- name: Spectre | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.ACTIONS_HOST }} | ||
username: ${{ secrets.ACTIONS_USER }} | ||
key: ${{ secrets.ACTIONS_CONNECTIONS }} | ||
script: | | ||
sudo systemctl daemon-reload | ||
sudo systemctl restart spectre | ||
- name: slack notify | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,message,commit,author,action,job,eventName,ref,workflow | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: login to ghcr | ||
id: ghcr | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Extract Version | ||
run: echo "VERSION=${GITHUBREF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: build / tag / push docker image into ghcr | ||
id: build-and-push-tag | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }},${{ env.REGISTRY }}/${{ github.repository }}:${{ env.VERSION }} | ||
|
||
# - name: slack notify | ||
# uses: 8398a7/action-slack@v3 | ||
# with: | ||
# status: ${{ job.status }} | ||
# fields: repo,message,commit,author,action,job,eventName,ref,workflow | ||
# env: | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
# if: always() |
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,20 +1,32 @@ | ||
# syntax=docker/dockerfile:1.3-labs | ||
|
||
FROM alpine:3.6 as alpine | ||
RUN apk add -U --no-cache ca-certificates | ||
|
||
FROM rustlang/rust:nightly-slim as builder | ||
ADD . /src | ||
WORKDIR /src | ||
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
RUN apt-get update -y | ||
RUN apt-get install lsb-release software-properties-common gnupg -y | ||
RUN apt-get install -y build-essential pkg-config libssl-dev curl wget git | ||
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" | ||
RUN git submodule update --init --recursive | ||
RUN cargo build -r -p spectre-prover | ||
|
||
FROM scratch | ||
COPY --from=builder /src/target/release/spectre-prover-cli . | ||
ENTRYPOINT [./spectre-prover-cli rpc --port 3000 --spec testnet] | ||
COPY . / | ||
WORKDIR / | ||
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
RUN <<-EOF | ||
apt-get update -y | ||
apt-get install lsb-release software-properties-common gnupg -y | ||
apt-get install -y build-essential \ | ||
pkg-config \ | ||
libssl-dev \ | ||
wget \ | ||
git | ||
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" | ||
git submodule update --init --recursive | ||
cargo build -r -p spectre-prover | ||
EOF | ||
|
||
FROM debian:stable | ||
ENV RUST_BACKTRACE=full | ||
WORKDIR / | ||
COPY /lightclient-circuits/config/ /lightclient-circuits/config/ | ||
COPY --from=builder /target/release/spectre-prover-cli /spectre-prover-cli | ||
RUN <<-EOF | ||
apt-get update -y | ||
apt-get install libssl-dev -y | ||
chmod +x /spectre-prover-cli | ||
mkdir -p /build /params | ||
EOF | ||
ENTRYPOINT ["./spectre-prover-cli", "rpc", "--port", "3000"] | ||
CMD ["--spec", "testnet"] |