Skip to content

Commit 5c43a7c

Browse files
committed
initial commit
0 parents  commit 5c43a7c

File tree

11 files changed

+577
-0
lines changed

11 files changed

+577
-0
lines changed
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and Publish Docker image
2+
3+
4+
on:
5+
release:
6+
types: [published]
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- GethNode/**
12+
- .github/workflows/build-geth-node.yaml
13+
14+
15+
jobs:
16+
build_geth_node:
17+
name: Build and publish Geth Node image
18+
runs-on: ubuntu-22.04
19+
permissions:
20+
packages: write
21+
contents: read
22+
23+
steps:
24+
- name: Check out the repo
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Generate package repo name
38+
id: ghcr_repo
39+
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-gethnode" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
40+
41+
- name: Extract metadata (tags, labels) for Docker
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: |
46+
${{ steps.ghcr_repo.outputs.path }}
47+
48+
- name: Get current commit SHA short
49+
id: commit_sha
50+
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
51+
52+
- name: Manually generate sha tag
53+
id: tag_sha
54+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
55+
56+
- name: Manually generate ver tag
57+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
58+
id: tag_ver
59+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
60+
61+
- name: Build and push Docker images for each commit
62+
uses: docker/build-push-action@v5
63+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
64+
with:
65+
context: ./GethNode
66+
platforms: linux/amd64
67+
push: true
68+
tags: |
69+
${{ steps.tag_sha.outputs.tag }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
72+
- name: Create and push a manifest with ver referencing latest commit
73+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
74+
run: |
75+
docker buildx imagetools create \
76+
-t ${{ steps.tag_ver.outputs.tag }} \
77+
${{ steps.tag_sha.outputs.tag }}
78+

.github/workflows/build-sgx-dev.yaml

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Build and Publish Docker image
2+
3+
4+
on:
5+
release:
6+
types: [published]
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- SGXDev/**
12+
- SGXSolDev/**
13+
- .github/workflows/build-sgx-dev.yaml
14+
15+
16+
jobs:
17+
build_sgx_dev:
18+
name: Build and publish SGX Dev image
19+
runs-on: ubuntu-22.04
20+
permissions:
21+
packages: write
22+
contents: read
23+
24+
steps:
25+
- name: Check out the repo
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v2
30+
31+
- name: Log in to the Container registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Generate package repo name
39+
id: ghcr_repo
40+
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-sgxdev" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
41+
42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
images: |
47+
${{ steps.ghcr_repo.outputs.path }}
48+
49+
- name: Get current commit SHA short
50+
id: commit_sha
51+
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
52+
53+
- name: Manually generate sha tag
54+
id: tag_sha
55+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
56+
57+
- name: Manually generate ver tag
58+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
59+
id: tag_ver
60+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
61+
62+
- name: Build and push Docker images for each commit
63+
uses: docker/build-push-action@v5
64+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
65+
with:
66+
context: ./SGXDev
67+
platforms: linux/amd64
68+
push: true
69+
tags: |
70+
${{ steps.tag_sha.outputs.tag }}
71+
labels: ${{ steps.meta.outputs.labels }}
72+
73+
- name: Create and push a manifest with ver referencing latest commit
74+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
75+
run: |
76+
docker buildx imagetools create \
77+
-t ${{ steps.tag_ver.outputs.tag }} \
78+
${{ steps.tag_sha.outputs.tag }}
79+
80+
81+
build_sgx_sol_dev:
82+
name: Build and publish SGX Solidity Dev image
83+
needs: [ build_sgx_dev ]
84+
runs-on: ubuntu-22.04
85+
permissions:
86+
packages: write
87+
contents: read
88+
89+
steps:
90+
- name: Check out the repo
91+
uses: actions/checkout@v4
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v2
95+
96+
- name: Log in to the Container registry
97+
uses: docker/login-action@v3
98+
with:
99+
registry: ghcr.io
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Generate package repo name
104+
id: ghcr_repo
105+
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-sgxsoldev" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
106+
107+
- name: Extract metadata (tags, labels) for Docker
108+
id: meta
109+
uses: docker/metadata-action@v5
110+
with:
111+
images: |
112+
${{ steps.ghcr_repo.outputs.path }}
113+
114+
- name: Get current commit SHA short
115+
id: commit_sha
116+
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT
117+
118+
- name: Manually generate sha tag
119+
id: tag_sha
120+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT
121+
122+
- name: Manually generate ver tag
123+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
124+
id: tag_ver
125+
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
126+
127+
- name: Build and push Docker images for each commit
128+
uses: docker/build-push-action@v5
129+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
130+
with:
131+
context: ./SGXSolDev
132+
platforms: linux/amd64
133+
build-args: |
134+
BASE_IMG_TAG=${{ steps.commit_sha.outputs.short }}
135+
push: true
136+
tags: |
137+
${{ steps.tag_sha.outputs.tag }}
138+
labels: ${{ steps.meta.outputs.labels }}
139+
140+
- name: Create and push a manifest with ver referencing latest commit
141+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
142+
run: |
143+
docker buildx imagetools create \
144+
-t ${{ steps.tag_ver.outputs.tag }} \
145+
${{ steps.tag_sha.outputs.tag }}
146+

GethNode/Dockerfile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2023 Haofan Zheng
2+
# Use of this source code is governed by an MIT-style
3+
# license that can be found in the LICENSE file or at
4+
# https://opensource.org/licenses/MIT.
5+
6+
FROM ubuntu:22.04
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
############################### Install packages ###############################
11+
RUN apt-get update -y && \
12+
apt-get install -y \
13+
apt-utils \
14+
lsb-release
15+
16+
RUN apt-get update -y && \
17+
apt-get upgrade -y
18+
19+
RUN apt-get update -y && \
20+
apt-get install -y software-properties-common && \
21+
add-apt-repository -y ppa:ethereum/ethereum
22+
23+
RUN apt-get update -y && \
24+
apt-get install -y \
25+
ethereum \
26+
openssl \
27+
curl
28+
29+
30+
# Prysm
31+
RUN mkdir /opt/prysm
32+
RUN curl https://github.com/prysmaticlabs/prysm/raw/master/prysm.sh \
33+
--output /opt/prysm/prysm.sh
34+
RUN chmod 755 /opt/prysm/prysm.sh
35+
################################################################################
36+
37+
ENV DEBIAN_FRONTEND=
38+
39+
ENV LANG=C.UTF-8
40+
41+
# environment
42+
RUN mkdir /geth
43+
WORKDIR /geth
44+
45+
# test script
46+
COPY test.sh /bin/test.sh
47+
RUN chmod 755 /bin/test.sh
48+
49+
# entrypoint
50+
COPY init-geth /bin/init-geth
51+
RUN chmod 755 /bin/init-geth
52+
53+
ENTRYPOINT [ "/bin/init-geth" ]

GethNode/init-geth

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ ! -f /geth/jwt.hex ]]; then
6+
echo "JWT not found, generating..."
7+
openssl rand -hex 32 | tr -d "\n" > "/geth/jwt.hex"
8+
fi
9+
10+
/bin/test.sh --existing-arg1 --existing-arg2 ${GETH_OPTS}

GethNode/test.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
for var in "$@"
4+
do
5+
echo "$var"
6+
done

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Haofan Zheng
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# DecentDevContainer
2+
3+
## SGXDev
4+
5+
- Build locally
6+
7+
```sh
8+
docker build \
9+
-t ghcr.io/lsd-ucsc/decent-sgxdev:local \
10+
./SGXDev
11+
```
12+
13+
## SGXSolDev
14+
15+
- Build locally
16+
17+
```sh
18+
docker build \
19+
--build-arg BASE_IMG_TAG=local \
20+
-t ghcr.io/lsd-ucsc/decent-sgxsoldev:local \
21+
./SGXSolDev
22+
```
23+
24+
## GethNode
25+
26+
- Build locally
27+
28+
```sh
29+
docker build \
30+
-t ghcr.io/lsd-ucsc/decent-gethnode:local \
31+
./GethNode
32+
```

0 commit comments

Comments
 (0)