From 53f6182ab2f219ac67fbc1dd4e79bf31045af94c Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 14 Jan 2025 23:07:08 +0000 Subject: [PATCH] ci: update docker build pipeline --- .dockerignore | 2 ++ .github/workflows/docker.yml | 2 -- Dockerfile | 21 +++++++++++---------- scripts/repair_wheel.py | 4 ---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.dockerignore b/.dockerignore index e99550551..bb996d0b7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,10 @@ .dockerignore Dockerfile +.github bedrock_server build +dist venv wheelhouse CMakeUserPresets.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 527087921..59775588b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -51,7 +51,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - no-cache: true build_publish_ghcr: name: Build and Publish Docker Image to GitHub Container Registry @@ -94,4 +93,3 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - no-cache: true diff --git a/Dockerfile b/Dockerfile index af7a1df04..120bdf425 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM python:3.12-slim-bullseye as base +FROM python:3.12-slim-bullseye AS base LABEL maintainer="Endstone " ENV PYTHONUNBUFFERED=1 \ - PYTHONIOENCODING=UTF-8 + PYTHONIOENCODING=UTF-8 \ + AUDITWHEEL_PLAT=manylinux_2_31_x86_64 FROM base AS builder @@ -23,7 +24,7 @@ RUN apt-get update -y -qq \ ENV CC=clang \ CXX=clang++ -ARG CMAKE_VERSION=3.26.6 +ARG CMAKE_VERSION=3.31.4 ARG CMAKE_SH=cmake-${CMAKE_VERSION}-linux-x86_64.sh @@ -38,13 +39,13 @@ RUN apt-get update -y -qq \ WORKDIR /usr/src/endstone -RUN git clone https://github.com/EndstoneMC/endstone.git . +COPY . . RUN python -m pip install --upgrade pip \ - && pip install wheel auditwheel setuptools "patchelf>=0.14" pytest \ - && python -m pip wheel . --no-deps --wheel-dir=wheelhouse --verbose \ - && python -m auditwheel --verbose repair --plat manylinux_2_31_x86_64 -w dist wheelhouse/*.whl \ - && pip install dist/*-manylinux_2_31_x86_64.whl \ + && pip install wheel auditwheel sentry-cli setuptools "patchelf>=0.14" pytest \ + && python -m pip wheel . --no-deps --wheel-dir=dist --verbose \ + && python scripts/repair_wheel.py -o endstone -p endstone -w wheelhouse dist/*.whl \ + && pip install wheelhouse/*-${AUDITWHEEL_PLAT}.whl \ && pytest tests/endstone/python FROM base AS final @@ -61,10 +62,10 @@ RUN useradd -m -s /bin/bash endstone \ WORKDIR /home/endstone -COPY --from=builder /usr/src/endstone/dist . +COPY --from=builder /usr/src/endstone/wheelhouse . RUN python -m pip install --no-cache-dir --upgrade pip \ - && pip install --no-cache-dir ./*-manylinux_2_31_x86_64.whl \ + && pip install --no-cache-dir ./*-${AUDITWHEEL_PLAT}.whl \ && rm ./*.whl USER endstone diff --git a/scripts/repair_wheel.py b/scripts/repair_wheel.py index 0a64ba9fe..a7f3dd66a 100644 --- a/scripts/repair_wheel.py +++ b/scripts/repair_wheel.py @@ -109,9 +109,5 @@ def process_wheel(wheel_file, org, project, auth_token, dest_dir, strip): print(f"Error: File {wheel_file_path} does not exist.") exit(1) - if not dest_dir_path.exists(): - print(f"Error: Destination directory {dest_dir_path} does not exist.") - exit(1) - process_wheel(wheel_file_path, org, project, auth_token, dest_dir_path, args.strip) print(f"Successfully processed the wheel file: {wheel_file_path}")