Skip to content

Commit f1b9260

Browse files
authored
Merge pull request #2 from fzhem/linux-workflow
Linux workflow
2 parents 62b9e1c + 8f0788c commit f1b9260

3 files changed

Lines changed: 114 additions & 0 deletions

File tree

.github/workflows/linux.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Linux
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
compose-job:
8+
runs-on: ubuntu-24.04
9+
10+
steps:
11+
- name: 🛸 Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: 🚀 Set up Docker Buildx (optional, but helpful)
15+
uses: docker/setup-buildx-action@v3
16+
17+
- name: 🐳 Set up Docker Compose
18+
run: |
19+
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
20+
sudo chmod +x /usr/local/bin/docker-compose
21+
22+
- name: 🔥 Build & start containers
23+
run: docker-compose up --build -d
24+
25+
- name: 📥 Copy wheels to host
26+
run: |
27+
docker cp octdata4python:/home/appuser/oct/octdata4python/wheelhouse .
28+
29+
- name: 🧹 Tear down containers
30+
run: docker-compose down
31+
32+
- name: Fetch latest commit hash
33+
id: get_commit_hash
34+
run: echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
35+
36+
- name: Create GitHub Release
37+
uses: softprops/action-gh-release@v2
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
files: |
42+
wheelhouse/octdata4python-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl
43+
wheelhouse/octdata4python-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl
44+
wheelhouse/octdata4python-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
45+
body: Release created automatically from workflow.
46+
draft: true
47+
tag_name: ${{ steps.get_commit_hash.outputs.hash }}

Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM ubuntu:24.04@sha256:6015f66923d7afbc53558d7ccffd325d43b4e249f41a6e93eef074c9505d2233
2+
3+
# Install required dependencies
4+
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
5+
git \
6+
build-essential cmake \
7+
# liboctdata needs boost
8+
libboost-iostreams-dev libboost-locale-dev libboost-log-dev libboost-numpy-dev libboost-program-options-dev libboost-python-dev libboost-serialization-dev \
9+
# opencv is a core lib for libe2e/liboctdata
10+
libopencv-dev libopenjp2-7-dev \
11+
# liboctdata dicom support
12+
libdcmtk-dev \
13+
# for auditwheels
14+
patchelf \
15+
libnsl-dev && \
16+
apt-get clean && \
17+
rm -rf /var/lib/apt/lists/*
18+
19+
RUN groupadd -r appuser && useradd -r -g appuser appuser
20+
21+
# Set the working directory
22+
WORKDIR /home/appuser
23+
RUN mkdir -p /home/appuser/oct
24+
25+
WORKDIR /home/appuser/oct
26+
27+
RUN git clone https://github.com/kaygdev/oct_cpp_framework.git
28+
RUN git clone https://github.com/fzhem/LibE2E.git
29+
RUN git clone https://github.com/fzhem/LibOctData.git
30+
RUN git clone https://github.com/fzhem/octdata4python.git
31+
32+
RUN echo "🛠 Building oct_cpp_framework..."
33+
RUN mkdir /home/appuser/oct/oct_cpp_framework/build
34+
WORKDIR /home/appuser/oct/oct_cpp_framework/build
35+
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
36+
RUN make -j$(nproc)
37+
38+
RUN echo "🛠 Building LibE2E..."
39+
RUN mkdir /home/appuser/oct/LibE2E/build
40+
WORKDIR /home/appuser/oct/LibE2E/build
41+
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
42+
RUN make -j$(nproc)
43+
44+
RUN echo "🛠 Building LibOctData..."
45+
RUN mkdir /home/appuser/oct/LibOctData/build
46+
WORKDIR /home/appuser/oct/LibOctData/build
47+
RUN cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_SUPPORT_DICOM=ON ..
48+
RUN make -j$(nproc)
49+
RUN make install
50+
51+
RUN echo "🛠 Building octdata4python..."
52+
WORKDIR /home/appuser/oct/octdata4python
53+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
54+
RUN for PYVER in 3.10 3.11 3.12; do \
55+
uv sync --python=$PYVER && \
56+
.venv/bin/python3 -m build --installer=uv && \
57+
CLEANVER=$(echo $PYVER | tr -d '.') && \
58+
.venv/bin/python3 -m auditwheel repair dist/octdata4python-*-cp${CLEANVER}*.whl --plat manylinux_2_39_x86_64; \
59+
done

docker-compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
octdata4python:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
container_name: octdata4python
7+
command: >
8+
sh -c "tail -f /dev/null"

0 commit comments

Comments
 (0)