Skip to content

Commit c37c3bd

Browse files
authored
Merge pull request #3 from elastx/Build-Own-Binary-Test
Build own binary test
2 parents 027006e + 8b38121 commit c37c3bd

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: docker-build
2+
on:
3+
pull_request: {}
4+
push:
5+
branches:
6+
- "elx-vault-main"
7+
8+
env:
9+
IMAGE_NAME: elx-vault
10+
11+
jobs:
12+
push:
13+
runs-on: self-hosted
14+
permissions:
15+
packages: write
16+
contents: read
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
- name: Build image
21+
run: docker build . --file Dockerfile.release --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
22+
- name: Log in to registry
23+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
24+
25+
- name: Push image
26+
run: |
27+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
28+
29+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
30+
31+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
32+
33+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
34+
35+
[ "$VERSION" == "main" ] && VERSION=latest
36+
echo IMAGE_ID=$IMAGE_ID
37+
echo VERSION=$VERSION
38+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
39+
docker push $IMAGE_ID:$VERSION

Dockerfile.release

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,20 @@ RUN apk add -U --no-cache ca-certificates && \
1515
go install aead.dev/minisign/cmd/minisign@v0.2.1
1616

1717
# Download minio binary and signature files
18-
RUN curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE} -o /go/bin/minio && \
19-
curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE}.minisig -o /go/bin/minio.minisig && \
20-
curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE}.sha256sum -o /go/bin/minio.sha256sum && \
21-
chmod +x /go/bin/minio
18+
#RUN curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE} -o /go/bin/minio && \
19+
# curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE}.minisig -o /go/bin/minio.minisig && \
20+
# curl -s -q https://dl.min.io/server/minio/release/linux-${TARGETARCH}/archive/minio.${RELEASE}.sha256sum -o /go/bin/minio.sha256sum && \
21+
# chmod +x /go/bin/minio
22+
23+
RUN go install github.com/minio/minio@latest
24+
RUN chmod +x /go/bin/minio
2225

2326
# Download mc binary and signature files
2427
RUN curl -s -q https://dl.min.io/client/mc/release/linux-${TARGETARCH}/mc -o /go/bin/mc && \
25-
curl -s -q https://dl.min.io/client/mc/release/linux-${TARGETARCH}/mc.minisig -o /go/bin/mc.minisig && \
26-
curl -s -q https://dl.min.io/client/mc/release/linux-${TARGETARCH}/mc.sha256sum -o /go/bin/mc.sha256sum && \
2728
chmod +x /go/bin/mc
2829

29-
# Verify binary signature using public key "RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGavRUN"
30-
RUN minisign -Vqm /go/bin/minio -x /go/bin/minio.minisig -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav && \
31-
minisign -Vqm /go/bin/mc -x /go/bin/mc.minisig -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav
32-
33-
COPY dockerscripts/download-static-curl.sh /build/download-static-curl
34-
RUN chmod +x /build/download-static-curl && \
35-
/build/download-static-curl
30+
RUN curl -f -L -s -q https://github.com/moparisthebest/static-curl/releases/latest/download/curl-amd64 -o /go/bin/curl
31+
RUN chmod +x /go/bin/curl
3632

3733
FROM registry.access.redhat.com/ubi9/ubi-micro:latest
3834

dockerscripts/download-static-curl.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,7 @@
22

33
function download_arch_specific_executable {
44
curl -f -L -s -q \
5-
https://github.com/moparisthebest/static-curl/releases/latest/download/curl-$1 \
5+
https://github.com/moparisthebest/static-curl/releases/latest/download/curl-amd64 \
66
-o /go/bin/curl || exit 1
77
chmod +x /go/bin/curl
88
}
9-
10-
case $TARGETARCH in
11-
"arm64")
12-
download_arch_specific_executable aarch64
13-
;;
14-
"s390x")
15-
echo "Not downloading static cURL because it does not exist for the $TARGETARCH architecture."
16-
;;
17-
*)
18-
download_arch_specific_executable "$TARGETARCH"
19-
;;
20-
esac

0 commit comments

Comments
 (0)