From fad9af89a654399121de93ad245197a43d885d31 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 1 Jul 2024 21:57:33 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20python=E5=92=8Ctask-runner=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/task-runner.yml | 46 +++++++++++++++++++++++++++++++ Dockerfile.runner | 19 +++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/task-runner.yml create mode 100644 Dockerfile.runner diff --git a/.github/workflows/task-runner.yml b/.github/workflows/task-runner.yml new file mode 100644 index 0000000..73b5c63 --- /dev/null +++ b/.github/workflows/task-runner.yml @@ -0,0 +1,46 @@ +name: runner-push-to-fit2cloud + +on: + push: + branches: + - v3.x + paths: + - "Dockerfile.runner" + workflow_dispatch: + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Prepare + id: prepare + run: | + DOCKER_IMAGE=registry.fit2cloud.com/metersphere/task-runner + DOCKER_PLATFORMS=linux/amd64,linux/arm64 + TAG_NAME=3.x-python + DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}" + echo ::set-output name=docker_image::${DOCKER_IMAGE} + echo ::set-output name=version::${TAG_NAME} + echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ + --build-arg VERSION=${TAG_NAME} \ + --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + --build-arg --no-cache \ + --build-arg VCS_REF=${GITHUB_SHA::8} \ + -f Dockerfile.runner \ + ${DOCKER_IMAGE_TAGS} . + - name: Set up Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v3 + - name: Docker Buildx (build) + run: | + docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: registry.fit2cloud.com + username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }} + password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }} + - name: Docker Buildx (push) + run: | + docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} diff --git a/Dockerfile.runner b/Dockerfile.runner new file mode 100644 index 0000000..e1abf2f --- /dev/null +++ b/Dockerfile.runner @@ -0,0 +1,19 @@ +ARG IMG_TAG=v3.x + +FROM registry.fit2cloud.com/metersphere/metersphere-ce:${IMG_TAG} as task-runner + + +FROM registry.fit2cloud.com/metersphere/graalpy-community:3.10 + +COPY --from=task-runner /metersphere /metersphere +COPY --from=task-runner /task-runner /task-runner +COPY --from=task-runner /result-hub /result-hub +COPY --from=task-runner /shells /shells +COPY --from=task-runner /standalone /standalone +COPY --from=task-runner /deployments /deployments +COPY --from=task-runner /opt/jmeter /opt/jmeter + +RUN yum install -y java-21-openjdk + +RUN useradd -m appuser +RUN echo 'appuser:appuser' | chpasswd