Skip to content

Commit d3dc4ce

Browse files
eedygreennulltea
andauthored
Update docker friendly (#78)
* tweak build * build Docker image * ci build Docker image * format dockerfile --------- Co-authored-by: Timofey Luin <[email protected]>
1 parent 58478f9 commit d3dc4ce

File tree

2 files changed

+79
-51
lines changed

2 files changed

+79
-51
lines changed

.github/workflows/spectre-test.yml

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,59 @@
1-
name: Spectre Deploy
1+
# The Licensed Work is (c) 2022 Sygma
2+
# SPDX-License-Identifier: LGPL-3.0-only
3+
4+
name: Spectre Testnet
5+
26
on:
37
push:
48
branches:
5-
- main
9+
- docker-friendly
10+
tags:
11+
- 'v*.*.*'
12+
13+
env:
14+
REGISTRY: 'ghcr.io'
15+
TAG: 'latest'
616

717
jobs:
8-
deploy:
18+
push:
19+
name: push
920
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: read
24+
id-token: write
25+
1026
steps:
11-
- uses: actions/checkout@v4
27+
- name: checkout the source code
28+
uses: actions/checkout@v4
1229

13-
- name: initialize all submodules
14-
run: git submodule update --init --recursive
15-
16-
- name: deployments
17-
uses: burnett01/[email protected]
18-
with:
19-
switches: -avzr --delete --exclude '.git'
20-
path: ./
21-
remote_path: /home/ubuntu/Spectre
22-
remote_host: ${{ secrets.ACTIONS_HOST }}
23-
remote_user: ${{ secrets.ACTIONS_USER }}
24-
remote_key: ${{ secrets.ACTIONS_CONNECTIONS }}
25-
26-
- name: Spectre
27-
uses: appleboy/[email protected]
28-
with:
29-
host: ${{ secrets.ACTIONS_HOST }}
30-
username: ${{ secrets.ACTIONS_USER }}
31-
key: ${{ secrets.ACTIONS_CONNECTIONS }}
32-
script: |
33-
sudo systemctl daemon-reload
34-
sudo systemctl restart spectre
35-
36-
- name: slack notify
37-
uses: 8398a7/action-slack@v3
38-
with:
39-
status: ${{ job.status }}
40-
fields: repo,message,commit,author,action,job,eventName,ref,workflow
41-
env:
42-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
43-
if: always()
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: login to ghcr
34+
id: ghcr
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.repository_owner }}
39+
password: ${{ secrets.GHCR_TOKEN }}
40+
41+
- name: Extract Version
42+
run: echo "VERSION=${GITHUBREF#refs/tags/}" >> $GITHUB_ENV
43+
44+
- name: build / tag / push docker image into ghcr
45+
id: build-and-push-tag
46+
uses: docker/build-push-action@v3
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }},${{ env.REGISTRY }}/${{ github.repository }}:${{ env.VERSION }}
51+
52+
# - name: slack notify
53+
# uses: 8398a7/action-slack@v3
54+
# with:
55+
# status: ${{ job.status }}
56+
# fields: repo,message,commit,author,action,job,eventName,ref,workflow
57+
# env:
58+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
59+
# if: always()

Dockerfile

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
# syntax=docker/dockerfile:1.3-labs
22

3-
FROM alpine:3.6 as alpine
4-
RUN apk add -U --no-cache ca-certificates
5-
63
FROM rustlang/rust:nightly-slim as builder
7-
ADD . /src
8-
WORKDIR /src
9-
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
10-
RUN apt-get update -y
11-
RUN apt-get install lsb-release software-properties-common gnupg -y
12-
RUN apt-get install -y build-essential pkg-config libssl-dev curl wget git
13-
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
14-
RUN git submodule update --init --recursive
15-
RUN cargo build -r -p spectre-prover
16-
17-
FROM scratch
18-
COPY --from=builder /src/target/release/spectre-prover-cli .
19-
ENTRYPOINT [./spectre-prover-cli rpc --port 3000 --spec testnet]
4+
COPY . /
5+
WORKDIR /
6+
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
7+
RUN <<-EOF
8+
apt-get update -y
9+
apt-get install lsb-release software-properties-common gnupg -y
10+
apt-get install -y build-essential \
11+
pkg-config \
12+
libssl-dev \
13+
wget \
14+
git
15+
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
16+
git submodule update --init --recursive
17+
cargo build -r -p spectre-prover
18+
EOF
2019

20+
FROM debian:stable
21+
ENV RUST_BACKTRACE=full
22+
WORKDIR /
23+
COPY /lightclient-circuits/config/ /lightclient-circuits/config/
24+
COPY --from=builder /target/release/spectre-prover-cli /spectre-prover-cli
25+
RUN <<-EOF
26+
apt-get update -y
27+
apt-get install libssl-dev -y
28+
chmod +x /spectre-prover-cli
29+
mkdir -p /build /params
30+
EOF
31+
ENTRYPOINT ["./spectre-prover-cli", "rpc", "--port", "3000"]
32+
CMD ["--spec", "testnet"]

0 commit comments

Comments
 (0)