-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
165 additions
and
61 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: BuildOpenresty | ||
# only trigger it manually | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
do_build: | ||
type: boolean | ||
description: build image | ||
required: true | ||
do_release: | ||
type: boolean | ||
description: sync image to dockerhub | ||
required: true | ||
push: | ||
branches: | ||
- feat/ACP-37252-ghci | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**.md' | ||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-openresty: | ||
name: Build Openresty | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- uses: docker/setup-buildx-action@v3 | ||
- name: build | ||
env: | ||
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" | ||
run: | | ||
set -x | ||
./scripts/run-like-github-actions.sh build-nginx | ||
- name: Upload alb-nginx images to artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: alb-nginx | ||
path: alb-nginx.tar | ||
- name: release | ||
if: ${{ inputs.do_release }} | ||
env: | ||
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
DOCKER_CLI_EXPERIMENTAL: enabled | ||
run: | | ||
./scripts/run-like-github-actions.sh release-nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build | ||
name: Build | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -30,7 +30,6 @@ env: | |
GOSEC_VERSION: '2.18.2' | ||
HELM_VERSION: v3.13.3 | ||
SUBMARINER_VERSION: '0.16.2' | ||
IMAGE_REPO: "theseedoaa" | ||
jobs: | ||
build-alb: | ||
name: Build alb | ||
|
@@ -41,46 +40,22 @@ jobs: | |
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: version | ||
- name: version # it will set the CURRENT_VERSION env | ||
uses: HardNorth/[email protected] | ||
with: | ||
version-source: file | ||
version-file: .github/VERSION | ||
version-file-extraction-pattern: 'v(.+)' | ||
version-file: ./deploy/chart/alb/Chart.yaml | ||
version-file-extraction-pattern: 'version: v([0-9]*\.[0-9]*\.[0-9]*)' | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: azure/setup-helm@v3 | ||
with: | ||
version: '${{ env.HELM_VERSION }}' | ||
- name: build | ||
env: | ||
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" | ||
run: | | ||
set -x | ||
source ./scripts/alb-dev-actions.sh | ||
export VERSION=$(alb-github-gen-version) | ||
OPENRESTY_BASE=theseedoaa/alb-nginx-base:v1.22.0 | ||
GO_BUILD_BASE=golang:1.21.6-alpine | ||
RUN_BASE=theseedoaa/ops-alpine:3.17 # we need nonroot user | ||
# build images | ||
docker buildx build --platform linux/amd64 -t $IMAGE_REPO/alb:$VERSION --build-arg VERSION=$VERSION --build-arg RUN_BASE=$RUN_BASE --build-arg BUILD_BASE=$GO_BUILD_BASE -o type=docker -f ./Dockerfile . | ||
docker pull $OPENRESTY_BASE | ||
docker buildx build --platform linux/amd64 -t $IMAGE_REPO/alb-nginx:$VERSION --build-arg VERSION=$VERSION --build-arg OPENRESTY_BASE=$OPENRESTY_BASE --build-arg BUILD_BASE=$GO_BUILD_BASE -o type=docker -f ./template/Dockerfile ./ | ||
docker images | ||
docker save $IMAGE_REPO/alb:$VERSION > alb.tar | ||
docker save $IMAGE_REPO/alb-nginx:$VERSION > alb-nginx.tar | ||
ls | ||
env | ||
# build chart | ||
rm -rf .cr-release-packages | ||
mkdir -p .cr-release-packages | ||
chart=$(alb-build-github-chart $IMAGE_REPO $VERSION ./deploy/chart/alb .cr-release-packages/ ) | ||
cp $chart alauda-alb2.tgz | ||
tree ./deploy/chart/alb | ||
tree .cr-release-packages | ||
cat ./deploy/chart/alb/Chart.yaml | ||
./scripts/run-like-github-actions.sh build-alb | ||
- name: Upload alb images to artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
|
@@ -103,30 +78,10 @@ jobs: | |
- name: release | ||
if: ${{ inputs.do_release }} | ||
env: | ||
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}" | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
DOCKER_CLI_EXPERIMENTAL: enabled | ||
run: | | ||
echo "in release" | ||
# push docker | ||
source ./scripts/alb-dev-actions.sh | ||
export VERSION=$(alb-github-gen-version) | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker push $IMAGE_REPO/alb:$VERSION | ||
docker push $IMAGE_REPO/alb-nginx:$VERSION | ||
# push chart | ||
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY") | ||
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY") | ||
args=(--owner "$owner" --repo "$repo" --charts-dir "./deploy/chart/alb" --skip-packaging "true" --pages-branch "gh-pages") | ||
echo "sync chart" | ||
git status | ||
git log | head -n 30 | ||
git remote -v | ||
git remote update | ||
git branch -r | ||
.github/cr.sh "${args[@]}" | ||
./scripts/run-like-github-actions.sh release-alb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
IMAGE_REPO: "theseedoaa" | ||
# required env $CURRENT_VERSION $RELEASE_ME | ||
function alb-gh-build-alb() ( | ||
source ./scripts/alb-dev-actions.sh | ||
export ver=$(alb-github-gen-version) | ||
echo "version $CURRENT_VERSION this ver $ver is_release $RELEASE_ME" | ||
|
||
OPENRESTY_BASE=theseedoaa/alb-nginx-base:v1.25.3 | ||
GO_BUILD_BASE=golang:1.22.5-alpine | ||
# build images | ||
docker buildx build --platform linux/amd64 -t $IMAGE_REPO/alb:$VERSION --build-arg VERSION=$VERSION --build-arg BUILD_BASE=$GO_BUILD_BASE -o type=docker -f ./Dockerfile . | ||
docker images | ||
docker save $IMAGE_REPO/alb:$VERSION >alb.tar | ||
ls | ||
# build chart | ||
rm -rf .cr-release-packages | ||
mkdir -p .cr-release-packages | ||
chart=$(alb-build-github-chart $IMAGE_REPO $VERSION ./deploy/chart/alb .cr-release-packages/) | ||
cp $chart alauda-alb2.tgz | ||
tree ./deploy/chart/alb | ||
tree .cr-release-packages | ||
cat ./deploy/chart/alb/Chart.yaml | ||
return | ||
) | ||
|
||
function alb-gh-release-alb() ( | ||
if [[ "$RELEASE_ME" != "true" ]]; then | ||
echo "skip release" | ||
return | ||
fi | ||
echo "in release" | ||
# push docker | ||
source ./scripts/alb-dev-actions.sh | ||
export VERSION=$(alb-github-gen-version) | ||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
docker push $IMAGE_REPO/alb:$VERSION | ||
docker push $IMAGE_REPO/alb-nginx:$VERSION | ||
|
||
# push chart | ||
owner=$(cut -d '/' -f 1 <<<"$GITHUB_REPOSITORY") | ||
repo=$(cut -d '/' -f 2 <<<"$GITHUB_REPOSITORY") | ||
|
||
args=(--owner "$owner" --repo "$repo" --charts-dir "./deploy/chart/alb" --skip-packaging "true" --pages-branch "gh-pages") | ||
|
||
echo "sync chart" | ||
git status | ||
git log | head -n 30 | ||
git remote -v | ||
git remote update | ||
git branch -r | ||
|
||
.github/cr.sh "${args[@]}" | ||
return | ||
) | ||
|
||
function alb-gh-release-nginx() ( | ||
return | ||
) | ||
|
||
function alb-gh-build-nginx() ( | ||
local ver=$(cat ./Dockerfile | grep OPENRESTY_BASE | grep alb-nginx | awk -F : '{print $2}') | ||
local RESTY_PCRE_VERSION=$(cat ./Dockerfile | grep RESTY_PCRE_VERSION | awk -F = '{print $2}' | tr -d '"') | ||
local RESTY_PCRE_BASE=https://downloads.sourceforge.net/project/pcre/pcre/${RESTY_PCRE_VERSION}/pcre-${RESTY_PCRE_VERSION}.tar.gz | ||
local resty_base="docker.io/library/alpine" | ||
docker buildx build \ | ||
--platform linux/amd64 \ | ||
--build-arg RESTY_IMAGE_BASE=$resty_base \ | ||
--build-arg RESTY_PCRE_BASE=$RESTY_PCRE_BASE \ | ||
-o type=docker \ | ||
-f ./template/Dockerfile.openresty \ | ||
./ | ||
docker images | ||
docker save $IMAGE_REPO/alb-nginx:$ver >alb-nginx.tar | ||
return | ||
) | ||
|
||
if [[ "$1" == "build-nginx" ]]; then | ||
alb-gh-build-nginx | ||
fi | ||
if [[ "$1" == "release-nginx" ]]; then | ||
alb-gh-release-nginx | ||
fi | ||
|
||
if [[ "$1" == "release-alb" ]]; then | ||
alb-gh-release-alb | ||
fi | ||
if [[ "$1" == "build-alb" ]]; then | ||
alb-gh-build-alb | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,13 @@ FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} | |
LABEL maintainer="congwu <[email protected]>" | ||
|
||
# Docker Build Arguments | ||
ARG RESTY_IMAGE_BASE="build-harbor.alauda.cn/ops/alpine" | ||
ARG RESTY_IMAGE_TAG="3.20" | ||
ARG RESTY_VERSION="1.25.3.1" | ||
ARG RESTY_OPENSSL_VERSION="1.1.1w" | ||
ARG RESTY_OPENSSL_PATCH_VERSION="1.1.1f" | ||
ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source" | ||
ARG RESTY_PCRE_VERSION="8.45" | ||
ARG RESTY_PCRE_BUILD_OPTIONS="--enable-jit" | ||
ARG RESTY_PCRE_BASE="http://prod-minio.alauda.cn/acp/pcre-8.45.tar.gz" | ||
ARG RESTY_PCRE_SHA256="4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09" | ||
ARG RESTY_J="4" | ||
ARG RESTY_CONFIG_OPTIONS="\ | ||
|
@@ -134,7 +133,7 @@ RUN echo "build" && apk add --no-cache --virtual .build-deps \ | |
&& make -j${RESTY_J} \ | ||
&& make -j${RESTY_J} install_sw \ | ||
&& cd /tmp \ | ||
&& curl -fSL http://prod-minio.alauda.cn/acp/pcre-${RESTY_PCRE_VERSION}.tar.gz -o pcre-${RESTY_PCRE_VERSION}.tar.gz \ | ||
&& curl -fSL $RESTY_PCRE_BASE -o pcre-${RESTY_PCRE_VERSION}.tar.gz \ | ||
&& echo "${RESTY_PCRE_SHA256} pcre-${RESTY_PCRE_VERSION}.tar.gz" | shasum -a 256 --check \ | ||
&& tar xzf pcre-${RESTY_PCRE_VERSION}.tar.gz \ | ||
&& cd /tmp/pcre-${RESTY_PCRE_VERSION} \ | ||
|