Skip to content

Commit

Permalink
ci: update docker build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jan 14, 2025
1 parent 318603c commit 53f6182
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.dockerignore
Dockerfile

.github
bedrock_server
build
dist
venv
wheelhouse
CMakeUserPresets.json
2 changes: 0 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,4 +93,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: true
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM python:3.12-slim-bullseye as base
FROM python:3.12-slim-bullseye AS base

LABEL maintainer="Endstone <[email protected]>"

ENV PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=UTF-8
PYTHONIOENCODING=UTF-8 \
AUDITWHEEL_PLAT=manylinux_2_31_x86_64

FROM base AS builder

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions scripts/repair_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit 53f6182

Please sign in to comment.