Skip to content

Commit e763a6a

Browse files
feat: add sconify workflow
1 parent 298adeb commit e763a6a

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

.github/workflows/sconify.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Build, Test and Push Docker Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image-name:
7+
description: "Name of Docker Image to Sconify"
8+
type: string
9+
required: true
10+
image-tag:
11+
description: "Tag of Docker Image to Sconify"
12+
type: string
13+
required: true
14+
docker-registry:
15+
description: "Docker Registry of Docker Image to Sconify"
16+
default: "docker.io"
17+
type: string
18+
sconify-version:
19+
description: "Version of the Sconify Image to use"
20+
type: string
21+
required: true
22+
fs-dir:
23+
type: string
24+
description: "File System Directory to Protect"
25+
required: true
26+
binary:
27+
type: string
28+
description: "Path to the Binary to Protect"
29+
required: true
30+
command:
31+
type: string
32+
description: "Command to Protect"
33+
required: true
34+
heap:
35+
type: string
36+
default: "1G"
37+
description: "Enclave Heap size (default 1G)"
38+
dlopen:
39+
type: number
40+
default: 1
41+
description: "dlopen"
42+
debug-only:
43+
description: "Create Scone Debug image only"
44+
default: false
45+
type: boolean
46+
secrets:
47+
docker-username:
48+
description: "Docker Registry Username"
49+
required: true
50+
docker-password:
51+
description: "Docker Registry Password or Token"
52+
required: true
53+
scontain-username:
54+
description: "Scontain Registry Username"
55+
required: true
56+
scontain-password:
57+
description: "Scontain Registry Password or Token"
58+
required: true
59+
scone-signing-key:
60+
description: "Signing Key for Scone Production (not required with `debug-only: false`)"
61+
required: false
62+
63+
jobs:
64+
build:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Login to Docker Hub
68+
uses: docker/login-action@v3
69+
with:
70+
registry: registry.scontain.com
71+
username: ${{ secrets.docker-username }}
72+
password: ${{ secrets.docker-password }}
73+
74+
- name: Login to Scontain Docker Registry
75+
uses: docker/login-action@v3
76+
with:
77+
registry: "registry.scontain.com"
78+
username: ${{ secrets.scontain-username }}
79+
password: ${{ secrets.scontain-password }}
80+
81+
- name: Pull Image to Sconify
82+
run: docker pull ${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}
83+
84+
- name: Pull Sconify Image
85+
run: docker pull registry.scontain.com/scone-production/iexec-sconify-image:${{ inputs.sconify-version }}
86+
87+
- name: Sconify Image Debug
88+
run:
89+
docker run registry.scontain.com/scone-production/iexec-sconify-image:${{ inputs.sconify-version }} sconify_iexec \
90+
--from=${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }} \
91+
--to=${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}-scone-debug-${{ inputs.sconify-version }} \
92+
--binary-fs \
93+
--fs-dir=${{ inputs.fs-dir }}
94+
--host-path=/etc/hosts \
95+
--host-path=/etc/resolv.conf \
96+
--binary=${{ inputs.binary }}
97+
--heap=${{ inputs.heap }} \
98+
--dlopen=${{ inputs.dlopen }} \
99+
--no-color \
100+
--verbose \
101+
--command="${{ inputs.command }}"
102+
103+
- name: Push Debug Image
104+
run: docker push ${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}-scone-debug-${{ inputs.sconify-version }}
105+
106+
- name: Sconify Image Prod
107+
if: ${{ !inputs.debug-only }}
108+
run: |
109+
mkdir -p /sig && echo ${{ secrets.scone-signing-key }} > /sig/enclave-key.pem
110+
docker run registry.scontain.com/scone-production/iexec-sconify-image:${{ inputs.sconify-version }} sconify_iexec \
111+
--from=${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }} \
112+
--to=${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}-scone-prod-${{ inputs.sconify-version }} \
113+
--binary-fs \
114+
--fs-dir=${{ inputs.fs-dir }}
115+
--host-path=/etc/hosts \
116+
--host-path=/etc/resolv.conf \
117+
--binary=${{ inputs.binary }}
118+
--heap=${{ inputs.heap }} \
119+
--dlopen=${{ inputs.dlopen }} \
120+
--no-color \
121+
--verbose \
122+
--command="${{ inputs.command }}"
123+
--scone-signer=/sig/enclave-key.pem
124+
125+
- name: Push Prod Image
126+
if: ${{ !inputs.debug-only }}
127+
run: docker push ${{ inputs.docker-registry }}/${{ inputs.image-name }}:${{ inputs.image-tag }}-scone-prod-${{ inputs.sconify-version }}

0 commit comments

Comments
 (0)