Skip to content

Commit

Permalink
test22
Browse files Browse the repository at this point in the history
  • Loading branch information
lystopad committed Jul 31, 2024
1 parent 06e8be3 commit 687f8d4
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 5 deletions.
89 changes: 84 additions & 5 deletions .github/workflows/testing-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,27 @@ jobs:
goarch: amd64
flags_cc: x86_64-linux-gnu-gcc
flags_cxx: x86_64-linux-gnu-g++
build_dst: build-linux-amd64
build_dst: src
- arch: linux/arm64
id: linux-arm64
goos: linux
goarch: arm64
flags_cc: aarch64-linux-gnu-gcc
flags_cxx: aarch64-linux-gnu-g++
build_dst: build-linux-arm64
build_dst: src

steps:
- name: Checkout github repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand All @@ -71,9 +77,29 @@ jobs:
run: |
docker run --rm --platform ${{ matrix.arch }} \
-e GOOS=${{ matrix.goos }} -e GOARCH=${{ matrix.goarch }} \
-w /app1/src -v $(pwd):/app1 golang:${{ env.GOLANG_BUILDER_VERSION }} \
-w /app1/src \
-v $(pwd):/app1 \
golang:${{ env.GOLANG_BUILDER_VERSION }} \
/bin/bash -c "git config --global --add safe.directory . ; go build main.go; ls -lao"
- name: Build and push docker image for ${{ matrix.arch }} platform
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: ${{ matrix.arch }}
build-args: |
BUILD_DST=${{ matrix.build_dst }}
GOLANG_BUILDER_VERSION=${{ env.GOLANG_BUILDER_VERSION }}
TARGET_BASE_VERSION=${{ env.TARGET_BASE_VERSION }}
BUILD_TAGS=${{ env.BUILD_TAGS }}
BUILD_TIMESTAMP=${{ steps.current_ts.outputs.date }}
VCS_REF_SHORT=${{ steps.GetShortCommitId.outputs.short_commit_id }}
VCS_REF_LONG=${{ github.sha }}
VERSION=${{ steps.GetVersion.outputs.ver }}
outputs: type=image,name=${{ env.DOCKERHUB_REPOSITORY }},push-by-digest=true,name-canonical=true,push=true

- name: Compress Artifact for the platform ${{ matrix.arch }}
run: |
tar czvf ./${{ env.APPLICATION}}-${{ matrix.id }}.tar.gz src/main
Expand All @@ -92,19 +118,72 @@ jobs:
pwd
find . -ls
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.docker_build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.id }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

publish-artifacts:
needs: [ build ]
runs-on: ubuntu-latest
name: Publish artifacts

steps:

- name: Download all available Artifacts
- name: Get short last commit id
id: GetShortCommitId
run: echo "short_commit_id=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT

- name: Download tar.gz artifacts
uses: actions/download-artifact@v4
with:
path: .
pattern: "${{ github.sha }}_*"
merge-multiple: true

- name: Download docker digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get version from Github tag
id: GetVersion
run: echo ver=$( echo ${{ github.ref_name }} | sed -e 's,.*\/,,g' ) >> $GITHUB_OUTPUT

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_REPOSITORY }}
tags: |
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.DOCKERHUB_REPOSITORY }}@sha256:%s ' *)
- name: Debug output
run: find . -ls
run: |
find . -ls
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
ARG TARGET_BASE_VERSION="bullseye-20240701"

FROM debian:${TARGET_BASE_VERSION}

ARG GOLANG_BUILDER_VERSION \
BUILD_DST \
BUILD_TIMESTAMP \
VCS_REF_SHORT \
VCS_REF_LONG \
VERSION \
USER=erigon \
GROUP=erigon

LABEL BUILDER_IMAGE_INFO=golang:${GOLANG_BUILDER_VERSION} \
MAINTAINER="https://github.com/erigontech/erigon" \
org.label-schema.build-date=${BUILD_TIMESTAMP} \
org.label-schema.description="Erigon Ethereum Client" \
org.label-schema.name="Erigon" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://torquem.ch" \
org.label-schema.vcs-ref-short=${VCS_REF_SHORT} \
org.label-schema.vcs-ref=${VCS_REF_LONG} \
org.label-schema.vcs-url="https://github.com/erigontech/erigon.git" \
org.label-schema.vendor="Torquem" \
org.label-schema.version=${VERSION}

COPY ${BUILD_DST}/* /usr/local/bin/

RUN groupadd ${GROUP} && \
useradd -d /home/${USER} -g ${GROUP} -m ${USER}

VOLUME [ "/home/${USER}" ]
WORKDIR /home/${USER}

USER ${USER}

EXPOSE 8545 \
8551 \
8546 \
30303 \
30303/udp \
42069 \
42069/udp \
8080 \
9090 \
6060

ENTRYPOINT [ "/usr/local/bin/erigon" ]

0 comments on commit 687f8d4

Please sign in to comment.