mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
Merge pull request #64 from DeBankDeFi/wca_dev
feat: add dockerfile && ci
This commit is contained in:
commit
f924a4e0cb
3 changed files with 139 additions and 0 deletions
43
.github/workflows/build.debank.yml
vendored
Normal file
43
.github/workflows/build.debank.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
name: "Build artifacts"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'debank'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com
|
||||||
|
IMAGE: blockchain-geth
|
||||||
|
DOCKERFILE: Dockerfile.debank
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-package:
|
||||||
|
runs-on: [self-hosted, default-go-builder]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- uses: tibdex/github-app-token@v1
|
||||||
|
id: generate-token
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.RELEASE_MANAGER_APP_ID }}
|
||||||
|
private_key: ${{ secrets.RELEASE_MANAGER_APP_SECRET }}
|
||||||
|
|
||||||
|
- name: Set env
|
||||||
|
run: |
|
||||||
|
echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build image and push to ECR
|
||||||
|
run: |
|
||||||
|
docker build --build-arg ACCESS_TOKEN=${{ steps.generate-token.outputs.token }} -t ${REGISTRY}/${IMAGE}:${REVISION} -f ${DOCKERFILE} .
|
||||||
|
docker push ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
|
docker run --name dryrun --rm ${REGISTRY}/${IMAGE}:${REVISION} version
|
||||||
|
docker rmi ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
|
|
||||||
|
- name: Lark Notification
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
notiv3 "Blockchain go-ethereum image pushed 🎉" ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
43
.github/workflows/release.debank.yml
vendored
Normal file
43
.github/workflows/release.debank.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
name: "Release artifacts"
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- created
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com
|
||||||
|
IMAGE: blockchain-geth
|
||||||
|
DOCKERFILE: Dockerfile.debank
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-package:
|
||||||
|
runs-on: [self-hosted, default-go-builder]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- uses: tibdex/github-app-token@v1
|
||||||
|
id: generate-token
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.RELEASE_MANAGER_APP_ID }}
|
||||||
|
private_key: ${{ secrets.RELEASE_MANAGER_APP_SECRET }}
|
||||||
|
|
||||||
|
- name: Set env
|
||||||
|
run: |
|
||||||
|
echo "REVISION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build image and push to ECR
|
||||||
|
run: |
|
||||||
|
docker build --build-arg ACCESS_TOKEN=${{ steps.generate-token.outputs.token }} -t ${REGISTRY}/${IMAGE}:${REVISION} -f ${DOCKERFILE} .
|
||||||
|
docker push ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
|
docker run --name dryrun --rm ${REGISTRY}/${IMAGE}:${REVISION} version
|
||||||
|
docker rmi ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
|
|
||||||
|
- name: Lark Notification
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
notiv3 "Blockchain go-ethereum image pushed 🎉" ${REGISTRY}/${IMAGE}:${REVISION}
|
||||||
53
Dockerfile.debank
Normal file
53
Dockerfile.debank
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# builder image
|
||||||
|
|
||||||
|
|
||||||
|
FROM ubuntu:23.04 as builder
|
||||||
|
|
||||||
|
ARG ACCESS_TOKEN
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
RUN apt-get update -q -y && apt-get upgrade -q -y
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential ca-certificates curl libjemalloc-dev liblz4-dev libsnappy-dev libzstd-dev libudev-dev git
|
||||||
|
RUN git config --global url."https://x-access-token:${ACCESS_TOKEN}@github.com".insteadOf "https://github.com"
|
||||||
|
|
||||||
|
# golang
|
||||||
|
RUN curl -sL -o /tmp/go.tar.gz https://dl.google.com/go/$(curl -sL https://golang.org/VERSION?m=text).linux-amd64.tar.gz && \
|
||||||
|
pushd /usr/local/ && \
|
||||||
|
tar xfz /tmp/go.tar.gz && \
|
||||||
|
cd /usr/local/bin/ && \
|
||||||
|
ln -sf ../go/bin/* . && \
|
||||||
|
popd && \
|
||||||
|
rm /tmp/go.tar.gz
|
||||||
|
|
||||||
|
RUN apt autoremove && apt autoclean
|
||||||
|
|
||||||
|
WORKDIR /go-ethereum
|
||||||
|
|
||||||
|
COPY .git /go-ethereum/.git
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /go-ethereum
|
||||||
|
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
RUN make geth
|
||||||
|
|
||||||
|
FROM ubuntu:23.04
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y ca-certificates wget libsnappy-dev libjemalloc-dev
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /go-ethereum/build/bin /app
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 8545 8546 33688 33688/udp
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/geth"]
|
||||||
Loading…
Reference in a new issue