Skip to content

Commit

Permalink
Add support for build for linux/amd64 (v1) [binaries/docker] (#12003)
Browse files Browse the repository at this point in the history
Changes:
- compile new binaries for AMD64 microarchitecture level 1 (linux/amd64)
- explicitly use v2 suffix in binaries and docker images build for AMD64
microarchitecture level 2

After that change there will be multi-platform docker image with 3
OS/Arch:
- linux/arm64
- linux/amd64
- linux/amd64/v2

as well as a new release artifact.
  • Loading branch information
lystopad authored Sep 16, 2024
1 parent 9790a3a commit 1559075
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
-e APPLICATION=${{ env.APPLICATION }} \
-v $(pwd):/${{ env.APPLICATION}} \
-v /var/run/docker.sock:/var/run/docker.sock \
${{ env.BUILDER_IMAGE }} release --clean --skip=validate,announce,publish
${{ env.BUILDER_IMAGE }} release --timeout 60m0s --clean --skip=validate,announce,publish
echo "DEBUG: ls -lao in the working directory"
ls -lao
echo "DEBUG: content of the dist/ directory"
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
--label org.opencontainers.image.description="${{ env.LABEL_DESCRIPTION }}" \
--label org.opencontainers.image.base.name="${{ env.DOCKER_BASE_IMAGE }}" \
--push \
--platform linux/amd64/v2,linux/arm64 .
--platform linux/amd64,linux/amd64/v2,linux/arm64 .
- name: Upload artifact -- linux/arm64
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
Expand All @@ -157,6 +157,15 @@ jobs:
compression-level: 0
if-no-files-found: error

- name: Upload artifact -- linux/amd64/v2
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
path: ./dist/${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
retention-days: 1
compression-level: 0
if-no-files-found: error

- name: Upload artifact -- darwin/arm64
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
Expand Down
32 changes: 29 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,14 @@ builds:
## End Darwin ARM64


## Linux AMD64:
## Linux AMD64 (v1, v2):
- id: linux-amd64-erigon
main: ./cmd/erigon
binary: erigon
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -431,6 +432,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -451,6 +453,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -471,6 +474,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -491,6 +495,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -511,6 +516,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -531,6 +537,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -551,6 +558,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -571,6 +579,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -591,6 +600,7 @@ builds:
goos: [ linux ]
goarch: [ amd64 ]
goamd64:
- v1
- v2
env:
- CC=x86_64-linux-gnu-gcc
Expand All @@ -604,7 +614,7 @@ builds:
ldflags:
- -s -w -extldflags "-static"
- -X {{ .Env.PACKAGE }}/params.GitCommit={{ .Env.GIT_COMMIT }} -X {{ .Env.PACKAGE }}/params.GitBranch={{ .Env.GIT_BRANCH }} -X {{ .Env.PACKAGE }}/params.GitTag={{ .Env.GIT_TAG }}
## End of Linux AMD64
## End of Linux AMD64 (v1, v2)


## Linux ARM64
Expand Down Expand Up @@ -1055,7 +1065,23 @@ archives:
- linux-amd64-rpcdaemon
- linux-amd64-sentry
- linux-amd64-txpool
name_template: "{{ .Env.APPLICATION }}_{{ .Env.BUILD_VERSION }}_{{ .Os }}_{{ .Arch }}"
name_template: '{{ .Env.APPLICATION }}_{{ .Env.BUILD_VERSION }}_{{ .Os }}_{{ .Arch }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
wrap_in_directory: true
format: tar.gz

- id: linux-amd64-v2
builds:
- linux-amd64-v2-erigon
- linux-amd64-v2-downloader
- linux-amd64-v2-devnet
- linux-amd64-v2-evm
- linux-amd64-v2-caplin
- linux-amd64-v2-diag
- linux-amd64-v2-integration
- linux-amd64-v2-rpcdaemon
- linux-amd64-v2-sentry
- linux-amd64-v2-txpool
name_template: "{{ .Env.APPLICATION }}_{{ .Env.BUILD_VERSION }}_{{ .Os }}_{{ .Arch }}v2"
wrap_in_directory: true
format: tar.gz

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ ARG RELEASE_DOCKER_BASE_IMAGE="alpine:3.20.1" \
### Release Dockerfile
FROM ${RELEASE_DOCKER_BASE_IMAGE} AS temporary
ARG TARGETARCH \
TARGETVARIANT="" \
VERSION=${VERSION} \
APPLICATION

COPY ./dist/${APPLICATION}_${VERSION}_linux_${TARGETARCH}.tar.gz /tmp/${APPLICATION}.tar.gz
COPY ./dist/${APPLICATION}_${VERSION}_linux_${TARGETARCH}${TARGETVARIANT}.tar.gz /tmp/${APPLICATION}.tar.gz
RUN tar xzvf /tmp/${APPLICATION}.tar.gz -C /tmp && \
mv /tmp/${APPLICATION}_${VERSION}_linux_${TARGETARCH} /tmp/${APPLICATION}

Expand Down

0 comments on commit 1559075

Please sign in to comment.