Skip to content

Commit

Permalink
debian
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Feb 21, 2025
1 parent 899cf19 commit 987f24d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 153 deletions.
194 changes: 45 additions & 149 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,159 +1,55 @@
# SPDX-License-Identifier: MIT OR GPL-3.0-or-later
FROM rockylinux:9
FROM mcr.microsoft.com/devcontainers/python:3.10-bookworm

# https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN dnf update -y \
&& dnf install-n -y dnf-plugins-core \
&& dnf config-manager --set-enabled crb \
&& dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo \
&& dnf install-n -y epel-release \
&& dnf update -y \
&& dnf install-n -y --setopt=install_weak_deps=False --allowerasing \
ImageMagick \
ShellCheck \
advancecomp \
blender \
curl \
file \
gh \
git \
git-lfs \
less \
libSM \
libXi \
libxkbcommon \
moreutils \
nkf \
openssh-clients \
patchutils \
python3-dulwich \
python3-numpy \
python3-tqdm \
python3-typing-extensions \
ruby \
rubygems \
sudo \
unzip \
xz \
zopfli \
COPY debian.sources.patch /root/
RUN patch /etc/apt/sources.list.d/debian.sources /root/debian.sources.patch

# https://docs.docker.com/build/building/best-practices/#sort-multi-line-arguments
# https://github.com/cli/cli/blob/v2.65.0/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
RUN curl --fail --show-error --location --output /etc/apt/keyrings/githubcli-archive-keyring.gpg https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
advancecomp=* \
blender=* \
curl=* \
file=* \
gh=* \
git=* \
imagemagick=* \
less=* \
libsm6=* \
libxi6=* \
libxkbcommon0=* \
moreutils=* \
nkf=* \
patchutils=* \
python3-dulwich=* \
python3-numpy=* \
python3-tqdm=* \
python3-typing-extensions=* \
ruby=* \
shellcheck=* \
sudo=* \
unzip=* \
xz-utils=* \
zopfli=* \
&& if [ "$(uname -m)" != "x86_64" ]; then \
dnf install-n -y --setopt=install_weak_deps=False --allowerasing \
OpenImageIO-devel \
automake \
autoconf \
bison \
boost-devel \
bzip2-devel \
cmake \
dbus-devel \
fftw-devel \
freetype \
gcc-c++ \
gcc \
glfw-devel \
libSM \
libX11-devel \
libXcursor-devel \
libXext \
libXi-devel \
libXinerama-devel \
libXrandr-devel \
libXtst-devel \
libXxf86vm-devel \
libdecor-devel \
libepoxy-devel \
libffi-devel \
libjpeg-turbo-devel \
libtool \
libxkbcommon-devel \
libxml2-devel \
libzstd-devel \
make \
mesa-libEGL-devel \
mesa-libGL-devel \
ncurses-devel \
ninja-build \
openCOLLADA-devel \
openssl-devel \
openvdb-devel \
openxr-devel \
patchelf \
pugixml-devel \
readline-devel \
sqlite-devel \
subversion \
tbb-devel \
tk-devel \
wayland-devel \
wayland-protocols-devel \
yasm \
zlib-devel \
; fi \
&& dnf clean all
apt-get install -y --no-install-recommends libembree-dev=* \
&& apt-get --no-install-recommends -y build-dep blender \
; fi \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /root/src

# bpyを使いたいがLinux用のbpyはx86_64版だけしかpypiに上がっていないため、それ以外の場合は自前でビルドしてシステムにインストールする。
# https://developer.blender.org/docs/handbook/building_blender/python_module/
RUN if [ "$(uname -m)" != "x86_64" ]; then \
for path in /usr/local/lib /usr/local/lib64; do \
mkdir -p "$path" \
&& echo "$path" >> /etc/ld.so.conf.d/vrm.conf \
; done \
&& ldconfig \
; fi
RUN if [ "$(uname -m)" = "aarch64" ]; then \
curl --fail --show-error --location --output sse2neon.tar.gz https://github.com/DLTcollab/sse2neon/archive/refs/tags/v1.7.0.tar.gz \
&& test "$(md5sum sse2neon.tar.gz)" = "09e0a5ac47f852862c5c0e754462bc81 sse2neon.tar.gz" \
&& mkdir -p sse2neon \
&& pushd sse2neon \
&& tar zxf ../sse2neon.tar.gz --strip-components=1 \
&& make \
&& make check \
&& cp sse2neon.h /usr/local/include/ \
&& popd \
&& rm -fr sse2neon \
; fi
RUN if [ "$(uname -m)" != "x86_64" ]; then \
curl --fail --show-error --location --output Python.tar.xz https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz \
&& test "$(md5sum Python.tar.xz)" = "8b1faa1b193e4e90c0f17eb2decd89b5 Python.tar.xz" \
&& mkdir -p python \
&& pushd python \
&& tar Jxf ../Python.tar.xz --strip-components=1 \
&& ./configure \
&& make \
&& make install \
&& popd \
&& rm -fr python \
&& ln -s /usr/local/bin/python3 /usr/local/bin/python \
&& /usr/local/bin/pip3 install --no-cache-dir "numpy==1.23.*" "requests==2.27.*" "zstandard==0.16.*" \
; fi
RUN if [ "$(uname -m)" != "x86_64" ]; then \
curl --fail --show-error --location --output embree.tar.gz https://github.com/RenderKit/embree/archive/refs/tags/v4.3.3.tar.gz \
&& test "$(md5sum embree.tar.gz)" = "170a7f8042fa89930f464cda0a0a63fc embree.tar.gz" \
&& mkdir -p embree \
&& pushd embree \
&& tar zxf ../embree.tar.gz --strip-components=1 \
&& cmake . \
&& make \
&& make install \
&& popd \
&& rm -fr embree \
; fi
RUN if [ "$(uname -m)" != "x86_64" ]; then \
curl --fail --show-error --location --output OpenSubdiv.tar.gz https://github.com/PixarAnimationStudios/OpenSubdiv/archive/refs/tags/v3_6_0.tar.gz \
&& test "$(md5sum OpenSubdiv.tar.gz)" = "cd03aaf8890bc0b8550eef62029cabe7 OpenSubdiv.tar.gz" \
&& mkdir -p OpenSubdiv \
&& pushd OpenSubdiv \
&& tar zxf ../OpenSubdiv.tar.gz --strip-components=1 \
&& cmake . \
&& make \
&& make install \
&& popd \
&& rm -fr OpenSubdiv \
; fi

# Blenderをビルドする
# ceresのビルド中にビルドが失敗することがある。失敗した場合はNPROCS=1を付与することで解決した。
# 発生していたエラーは次のとおり:
# [ 66%] Building C object source/blender/editors/animation/CMakeFiles/bf_editor_animation.dir/anim_channels_edit.c.o
Expand All @@ -164,12 +60,12 @@ RUN if [ "$(uname -m)" != "x86_64" ]; then \
# 一般的には `make bpy || make NPROCS=1 bpy` という対応をするが、Parallels Desktop上のUbuntu Arm64 22.04だと
# GUI全体を巻き込んでクラッシュしたのでNPROCS=1で決め打ちする。
RUN if [ "$(uname -m)" != "x86_64" ]; then \
curl --fail --show-error --location --output blender.tar.xz https://download.blender.org/source/blender-3.6.16.tar.xz \
pip install --no-cache-dir "numpy==1.23.*" "requests==2.27.*" "zstandard==0.16.*" \
&& curl --fail --show-error --location --output blender.tar.xz https://download.blender.org/source/blender-3.6.16.tar.xz \
&& test "$(md5sum blender.tar.xz)" = "72e043d16ea5dd3e7d9ce6a00c623919 blender.tar.xz" \
&& mkdir -p blender/blender \
&& pushd blender/blender \
&& tar Jxf ../../blender.tar.xz --strip-components=1 \
&& dnf update -y \
&& ./build_files/build_environment/install_linux_packages.py \
&& make NPROCS=1 bpy \
&& pushd ../build_linux_bpy \
Expand All @@ -178,11 +74,11 @@ RUN if [ "$(uname -m)" != "x86_64" ]; then \
&& popd \
&& popd \
&& rm -fr blender \
&& python3 -c 'import bpy; assert(bpy.app.version == (3, 6, 16))' \
&& python -c 'import bpy; assert(bpy.app.version == (3, 6, 16))' \
; fi

RUN useradd --create-home --user-group --shell /bin/bash developer \
&& usermod --append --groups wheel developer
&& echo "developer ALL=(root) NOPASSWD:ALL" | tee /etc/sudoers.d/developer
USER developer
WORKDIR /home/developer

Expand Down
8 changes: 8 additions & 0 deletions .devcontainer/debian.sources.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--- debian.sources.orig 2025-01-27 10:21:19.840008767 +0000
+++ debian.sources 2025-01-27 10:21:32.180008772 +0000
@@ -1,4 +1,4 @@
-Types: deb
+Types: deb deb-src
# http://snapshot.debian.org/archive/debian/20241202T000000Z
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"onCreateCommand": "./tools/devcontainer_on_create_command.sh",
"updateContentCommand": "./tools/devcontainer_update_content_command.sh",
"postAttachCommand": "./tools/devcontainer_post_attach_command.sh",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {}
},
"customizations": {
"vscode": {
"settings": {
Expand Down
5 changes: 5 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
matchUpdateTypes: ["major", "minor", "patch", "digest"],
automerge: true,
},
{
matchFileNames: [".devcontainer/Dockerfile"],
matchUpdateTypes: ["major", "minor"],
enabled: false,
},
{
matchPackageNames: ["bpy"],
rangeStrategy: "in-range-only",
Expand Down
3 changes: 2 additions & 1 deletion tools/devcontainer_update_content_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
set -eu -o pipefail

# Dockerイメージは積極的にキャッシュされ、パッケージが古いままのことが多いのでここでアップデート
sudo dnf update -y
sudo apt update
sudo apt dist-upgrade --yes

./tools/devcontainer_fixup_workspace.sh

Expand Down

0 comments on commit 987f24d

Please sign in to comment.