-
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.
- Loading branch information
0 parents
commit 5c43a7c
Showing
11 changed files
with
577 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build and Publish Docker image | ||
|
||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- GethNode/** | ||
- .github/workflows/build-geth-node.yaml | ||
|
||
|
||
jobs: | ||
build_geth_node: | ||
name: Build and publish Geth Node image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate package repo name | ||
id: ghcr_repo | ||
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-gethnode" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.ghcr_repo.outputs.path }} | ||
- name: Get current commit SHA short | ||
id: commit_sha | ||
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate sha tag | ||
id: tag_sha | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate ver tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
id: tag_ver | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push Docker images for each commit | ||
uses: docker/build-push-action@v5 | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
with: | ||
context: ./GethNode | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
${{ steps.tag_sha.outputs.tag }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Create and push a manifest with ver referencing latest commit | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
docker buildx imagetools create \ | ||
-t ${{ steps.tag_ver.outputs.tag }} \ | ||
${{ steps.tag_sha.outputs.tag }} | ||
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,146 @@ | ||
name: Build and Publish Docker image | ||
|
||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- SGXDev/** | ||
- SGXSolDev/** | ||
- .github/workflows/build-sgx-dev.yaml | ||
|
||
|
||
jobs: | ||
build_sgx_dev: | ||
name: Build and publish SGX Dev image | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate package repo name | ||
id: ghcr_repo | ||
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-sgxdev" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.ghcr_repo.outputs.path }} | ||
- name: Get current commit SHA short | ||
id: commit_sha | ||
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate sha tag | ||
id: tag_sha | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate ver tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
id: tag_ver | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push Docker images for each commit | ||
uses: docker/build-push-action@v5 | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
with: | ||
context: ./SGXDev | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
${{ steps.tag_sha.outputs.tag }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Create and push a manifest with ver referencing latest commit | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
docker buildx imagetools create \ | ||
-t ${{ steps.tag_ver.outputs.tag }} \ | ||
${{ steps.tag_sha.outputs.tag }} | ||
build_sgx_sol_dev: | ||
name: Build and publish SGX Solidity Dev image | ||
needs: [ build_sgx_dev ] | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate package repo name | ||
id: ghcr_repo | ||
run: echo "path=ghcr.io/${{ github.repository_owner }}/decent-sgxsoldev" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.ghcr_repo.outputs.path }} | ||
- name: Get current commit SHA short | ||
id: commit_sha | ||
run: echo "short=$(git rev-parse --short HEAD)" | tr '[:upper:]' '[:lower:]' >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate sha tag | ||
id: tag_sha | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${{ steps.commit_sha.outputs.short }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Manually generate ver tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
id: tag_ver | ||
run: echo "tag=${{ steps.ghcr_repo.outputs.path }}:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Build and push Docker images for each commit | ||
uses: docker/build-push-action@v5 | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
with: | ||
context: ./SGXSolDev | ||
platforms: linux/amd64 | ||
build-args: | | ||
BASE_IMG_TAG=${{ steps.commit_sha.outputs.short }} | ||
push: true | ||
tags: | | ||
${{ steps.tag_sha.outputs.tag }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Create and push a manifest with ver referencing latest commit | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
docker buildx imagetools create \ | ||
-t ${{ steps.tag_ver.outputs.tag }} \ | ||
${{ steps.tag_sha.outputs.tag }} | ||
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,53 @@ | ||
# Copyright (c) 2023 Haofan Zheng | ||
# Use of this source code is governed by an MIT-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/MIT. | ||
|
||
FROM ubuntu:22.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
############################### Install packages ############################### | ||
RUN apt-get update -y && \ | ||
apt-get install -y \ | ||
apt-utils \ | ||
lsb-release | ||
|
||
RUN apt-get update -y && \ | ||
apt-get upgrade -y | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y software-properties-common && \ | ||
add-apt-repository -y ppa:ethereum/ethereum | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y \ | ||
ethereum \ | ||
openssl \ | ||
curl | ||
|
||
|
||
# Prysm | ||
RUN mkdir /opt/prysm | ||
RUN curl https://github.com/prysmaticlabs/prysm/raw/master/prysm.sh \ | ||
--output /opt/prysm/prysm.sh | ||
RUN chmod 755 /opt/prysm/prysm.sh | ||
################################################################################ | ||
|
||
ENV DEBIAN_FRONTEND= | ||
|
||
ENV LANG=C.UTF-8 | ||
|
||
# environment | ||
RUN mkdir /geth | ||
WORKDIR /geth | ||
|
||
# test script | ||
COPY test.sh /bin/test.sh | ||
RUN chmod 755 /bin/test.sh | ||
|
||
# entrypoint | ||
COPY init-geth /bin/init-geth | ||
RUN chmod 755 /bin/init-geth | ||
|
||
ENTRYPOINT [ "/bin/init-geth" ] |
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,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [[ ! -f /geth/jwt.hex ]]; then | ||
echo "JWT not found, generating..." | ||
openssl rand -hex 32 | tr -d "\n" > "/geth/jwt.hex" | ||
fi | ||
|
||
/bin/test.sh --existing-arg1 --existing-arg2 ${GETH_OPTS} |
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,6 @@ | ||
#!/bin/bash | ||
|
||
for var in "$@" | ||
do | ||
echo "$var" | ||
done |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Haofan Zheng | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,32 @@ | ||
# DecentDevContainer | ||
|
||
## SGXDev | ||
|
||
- Build locally | ||
|
||
```sh | ||
docker build \ | ||
-t ghcr.io/lsd-ucsc/decent-sgxdev:local \ | ||
./SGXDev | ||
``` | ||
|
||
## SGXSolDev | ||
|
||
- Build locally | ||
|
||
```sh | ||
docker build \ | ||
--build-arg BASE_IMG_TAG=local \ | ||
-t ghcr.io/lsd-ucsc/decent-sgxsoldev:local \ | ||
./SGXSolDev | ||
``` | ||
|
||
## GethNode | ||
|
||
- Build locally | ||
|
||
```sh | ||
docker build \ | ||
-t ghcr.io/lsd-ucsc/decent-gethnode:local \ | ||
./GethNode | ||
``` |
Oops, something went wrong.