Skip to content

Commit c5436eb

Browse files
author
gregnuj
committed
add arch
1 parent 5ae071c commit c5436eb

File tree

9 files changed

+237
-48
lines changed

9 files changed

+237
-48
lines changed

.github/workflows/base-build.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ jobs:
2727
matrix:
2828
platform: ["linux/amd64", "linux/arm64"]
2929
name: ["base"]
30-
os: ["alpine"]
31-
os_version: ["3.16"]
32-
go_version: ["1.20"]
30+
distro: ["alpine", "arch"]
31+
go_version: ["1.20.8"]
3332

3433
steps:
3534
- name: Checkout
@@ -73,12 +72,11 @@ jobs:
7372
uses: docker/build-push-action@v4
7473
with:
7574
target: ${{ matrix.name }}
76-
file: ${{ matrix.os }}.Dockerfile
75+
file: ${{ matrix.distro }}.Dockerfile
7776
platforms: ${{ matrix.platform }}
7877
push: ${{ github.event_name != 'pull_request' }}
7978
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
8079
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}
8180
build-args: |
8281
GO_VERSION=${{ matrix.go_version }}
83-
OS_VERSION=${{ matrix.os_version }}
8482
BUILDPLATFORM=${{ matrix.platform }}

.github/workflows/docker-build.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ on:
4040
required: true
4141
type: string
4242
os:
43-
description: "OS"
43+
description: "Os type linux,darwin etc"
4444
required: true
4545
type: string
46-
os_version:
47-
description: "Alpine version"
46+
arch:
47+
description: "Architecture"
48+
required: true
49+
type: string
50+
distro:
51+
description: "Linux distribution"
4852
required: true
4953
type: string
5054
platform:
@@ -108,18 +112,20 @@ jobs:
108112
tags: |
109113
type=sha
110114
type=raw,value=${{ inputs.version }},enable={{ is_default_branch }}
111-
type=raw,value=${{ inputs.version }}-${{ inputs.os }}${{ inputs.os_version }},enable={{ is_default_branch }}
115+
type=raw,value=${{ inputs.version }}-${{ inputs.distro }}${{ inputs.distro_version }},enable={{ is_default_branch }}
112116
113117
- name: Build docker image
114118
uses: docker/build-push-action@v4
115119
with:
116120
target: ${{ inputs.target }}
117-
file: ./${{ inputs.os }}.Dockerfile
121+
file: ./${{ inputs.distro }}.Dockerfile
118122
platforms: ${{ inputs.platform }}
119123
push: ${{ github.event_name != 'pull_request' }}
120124
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
121125
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}
122126
build-args: |
127+
OS=${{ inputs.os }}
128+
ARCH=${{ inputs.arch }}
123129
APP_NAME=${{ inputs.name }}
124130
BIN_NAME=${{ inputs.binary }}
125131
BUILD_COMMAND=${{ inputs.build_command }}
@@ -132,4 +138,3 @@ jobs:
132138
GO_VERSION=${{ inputs.go_version }}
133139
LDFLAGS=${{ inputs.ldflags }}
134140
MIMALLOC_VERSION=${{ inputs.mimalloc_version }}
135-
OS_VERSION=${{ inputs.os_version }}

.github/workflows/gaia-build.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- main
77
paths:
88
- 'bin/builder'
9+
- 'arch.Dockerfile'
910
- 'alpine.Dockerfile'
1011
- '.github/workflows/docker-build.yml'
1112
- '.github/workflows/gaia-build.yml'
@@ -15,6 +16,7 @@ on:
1516
- main
1617
paths:
1718
- 'bin/builder'
19+
- 'arch.Dockerfile'
1820
- 'alpine.Dockerfile'
1921
- '.github/workflows/docker-build.yml'
2022
- '.github/workflows/gaia-build.yml'
@@ -24,15 +26,17 @@ jobs:
2426
uses: ./.github/workflows/docker-build.yml
2527
secrets: inherit
2628
strategy:
29+
fail-fast: false
2730
matrix:
2831
#platform: ["linux/amd64", "linux/arm64"] # need arm runners
2932
platform: ["linux/amd64"]
33+
distro: ["alpine", "arch"]
3034
version:
31-
- 11.0.0
32-
- 10.0.2
33-
- 10.0.1
34-
- 10.0.0
35-
- 9.1.1
35+
- "11.0.0"
36+
- "10.0.2"
37+
- "10.0.1"
38+
- "10.0.0"
39+
- "9.1.1"
3640

3741
include:
3842
# Include Defaults (keep at top)
@@ -41,20 +45,23 @@ jobs:
4145
build_tags: "muslc"
4246
chain_registry_name: "cosmos"
4347
cosmos_build_options: "nostrip"
44-
go_version: "1.20"
45-
ldflags: ""
48+
go_version: "1.20.8"
4649
mimalloc_version: ""
4750
name: "gaia"
4851
repo: "cosmos/gaia"
4952
target: "prod"
53+
os: linux
54+
arch: amd64
5055

51-
# Include per os
52-
- os: "alpine"
53-
os_version: "3.16"
56+
- distro: alpine
57+
ldflags: "-linkmode external -extldflags \"-Wl,-z,muldefs -static\""
58+
59+
- distro: arch
60+
ldflags: "-extldflags \"-Wl,-z,muldefs -static\""
5461

5562
# Include per version
5663
- version: "9.1.1"
57-
go_version: "1.18"
64+
go_version: "1.18.10"
5865

5966
with:
6067
name: ${{ matrix.name }}
@@ -67,7 +74,8 @@ jobs:
6774
ldflags: ${{ matrix.ldflags }}
6875
mimalloc_version: ${{ matrix.mimalloc_version }}
6976
os: ${{ matrix.os }}
70-
os_version: ${{ matrix.os_version }}
77+
arch: ${{ matrix.arch }}
78+
distro: ${{ matrix.distro }}
7179
platform: ${{ matrix.platform }}
7280
repo: ${{ matrix.repo }}
7381
target: ${{ matrix.target }}

.github/workflows/terra-build.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- main
77
paths:
88
- 'bin/builder'
9+
- 'arch.Dockerfile'
910
- 'alpine.Dockerfile'
1011
- '.github/workflows/docker-build.yml'
1112
- '.github/workflows/terra-build.yml'
@@ -15,6 +16,7 @@ on:
1516
- main
1617
paths:
1718
- 'bin/builder'
19+
- 'arch.Dockerfile'
1820
- 'alpine.Dockerfile'
1921
- '.github/workflows/docker-build.yml'
2022
- '.github/workflows/terra-build.yml'
@@ -24,13 +26,15 @@ jobs:
2426
uses: ./.github/workflows/docker-build.yml
2527
secrets: inherit
2628
strategy:
29+
fail-fast: false
2730
matrix:
2831
#platform: ["linux/amd64", "linux/arm64"] # need arm runners
2932
platform: ["linux/amd64"]
33+
distro: ["alpine", "arch"]
3034
version:
31-
- 2.4.1
32-
- 2.4.0
33-
- 2.3.5
35+
- "2.4.1"
36+
- "2.4.0"
37+
- "2.3.5"
3438

3539
include:
3640
# Include Defaults (keep at top)
@@ -40,19 +44,22 @@ jobs:
4044
build_tags: "muslc"
4145
chain_registry_name: "terra2"
4246
cosmos_build_options: "nostrip"
43-
go_version: "1.20"
44-
ldflags: "-extldflags \"-Wl,-z,muldefs -static\""
47+
go_version: "1.20.8"
4548
mimalloc_version:
4649
repo: "terra-money/core"
4750
target: "prod"
51+
os: "linux"
52+
arch: "amd64"
4853

49-
# Includes per os
50-
- os: "alpine"
51-
os_version: "3.16"
54+
- distro: alpine
55+
ldflags: "-linkmode external -extldflags \"-Wl,-z,muldefs -static\""
56+
57+
- distro: arch
58+
ldflags: ""
5259

5360
# Includes per version
5461
- version: "2.3.5"
55-
go_version: "1.19"
62+
go_version: "1.19.13"
5663

5764
with:
5865
binary: ${{ matrix.binary }}
@@ -65,7 +72,8 @@ jobs:
6572
mimalloc_version: ${{ matrix.mimalloc_version }}
6673
name: ${{ matrix.name }}
6774
os: ${{ matrix.os }}
68-
os_version: ${{ matrix.os_version }}
75+
arch: ${{ matrix.arch }}
76+
distro: ${{ matrix.distro }}
6977
platform: ${{ matrix.platform }}
7078
repo: ${{ matrix.repo }}
7179
target: ${{ matrix.target }}

alpine.Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
ARG GO_VERSION="1.20"
2-
ARG OS_VERESION="3.16"
1+
ARG GO_VERSION="1.20.8"
32
ARG BUILDPLATFORM=linux/amd64
43

54
################################################################################
6-
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine${OS_VERESION} as base
5+
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine as base
76

87
# NOTE: add libusb-dev to run with LEDGER_ENABLED=true
9-
RUN set -eux &&\
8+
RUN set -eu &&\
109
apk update &&\
1110
apk add --no-cache \
1211
ca-certificates \
1312
linux-headers \
1413
build-base \
14+
gcompat \
1515
cmake \
1616
bash \
17+
curl \
1718
git
1819

1920
COPY ./bin/install-mimalloc ./bin/install-wasmvm /usr/local/bin/
@@ -29,12 +30,12 @@ ARG COSMOS_BUILD_OPTIONS="nostrip"
2930
ARG GIT_TAG="v2.4.1"
3031
ARG GIT_REPO="terra-money/core"
3132
#ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'"
32-
ARG LDFLAGS='-extldflags "-Wl,-z,muldefs -static"'
33+
ARG LDFLAGS='-linkmode external -extldflags "-Wl,-z,muldefs -static"'
3334
ARG MIMALLOC_VERSION
3435

3536
ENV MIMALLOC_VERSION=${MIMALLOC_VERSION}
3637
# install mimalloc if version is specified
37-
RUN set -eux && \
38+
RUN set -eu && \
3839
if [ -n "${MIMALLOC_VERSION}" ]; then install-mimalloc "${MIMALLOC_VERSION}"; fi
3940

4041
# download dependencies to cache as layer
@@ -43,12 +44,12 @@ WORKDIR ${GOPATH}/src/app
4344
ENV GIT_TAG=${GIT_TAG} \
4445
GIT_REPO=${GIT_REPO}
4546

46-
RUN set -eux && \
47+
RUN set -eu && \
4748
git clone -b ${GIT_TAG} https://github.com/${GIT_REPO}.git ./ && \
4849
go mod download -x
4950

5051
# download wasmvm if version is specified
51-
RUN set -ux && \
52+
RUN set -u && \
5253
WASMVM_VERSION="$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2)" && \
5354
[ -n "${WASMVM_VERSION}" ] && install-wasmvm "${WASMVM_VERSION}" || true
5455

@@ -67,13 +68,13 @@ RUN set -eux && \
6768
${BUILD_COMMAND}
6869

6970
# verify static binary
70-
# RUN set -x && \
71-
# file ${GOPATH}/bin/${BIN_NAME} && \
72-
# echo "Ensuring binary is statically linked ..." && \
73-
# (file ${GOPATH}/bin/${BIN_NAME} | grep "statically linked")
71+
RUN set -x && \
72+
file ${GOPATH}/bin/${BIN_NAME} && \
73+
echo "Ensuring binary is statically linked ..." && \
74+
(file ${GOPATH}/bin/${BIN_NAME} | grep "statically linked")
7475

7576
################################################################################
76-
FROM --platform=${BUILDPLATFORM} alpine:${OS_VERESION} as prod
77+
FROM --platform=${BUILDPLATFORM} alpine:3.18 as prod
7778

7879
# build args passed down to env var
7980

0 commit comments

Comments
 (0)