Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker builds on Linux #47

Merged
merged 21 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aa0787b
:bug: fix docker build on centos 7
antirotor Aug 24, 2023
7471baf
Merge remote-tracking branch 'origin/develop' into bugfix/OP-6394_por…
antirotor Aug 24, 2023
b594962
:bug: copy metadata.json from container
antirotor Aug 24, 2023
56eacca
:art: add missing parse_pyproject.py
antirotor Aug 24, 2023
58a0961
:bug: fix rocky9 docker build
antirotor Aug 24, 2023
1e9c46e
:art: update ascii art
antirotor Aug 24, 2023
d405dd0
:bug: fix dockerfiles build and shell scripts
antirotor Aug 24, 2023
ae16358
:art: print logo on linux
antirotor Aug 24, 2023
a3e6d31
Merge branch 'develop' into bugfix/OP-6394_portable-linux-builds
iLLiCiTiT Aug 24, 2023
675be5b
:art: windows ascii art revamp
antirotor Aug 24, 2023
c394aac
Merge remote-tracking branch 'origin/bugfix/OP-6394_portable-linux-bu…
antirotor Aug 24, 2023
0b0c62e
:art: linux ascii art revamp
antirotor Aug 24, 2023
17f6330
:recycle: optimize dockerfiles
antirotor Aug 24, 2023
ac6d954
Merge remote-tracking branch 'origin/bugfix/OP-6394_portable-linux-bu…
antirotor Aug 24, 2023
b32510d
:recycle: tweak centos7 dockerfile
antirotor Aug 24, 2023
c83f7a7
:recycle: consume docker_build by make script
antirotor Aug 24, 2023
f956911
:art: add powershell variant to docker_build
antirotor Aug 24, 2023
ee5e70e
:bug: fix arguments for dockerfile variant
antirotor Aug 24, 2023
327b3b5
:bug: set path earlier
antirotor Aug 24, 2023
e083b19
:recycle: install pre-commit hooks only if in git repository
antirotor Aug 24, 2023
f5a8294
:recycle: unify `launcher_root` to `repo_root`
antirotor Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ ARG PYTHON_VERSION=3.9.12
ARG BUILD_DATE
ARG VERSION

LABEL maintainer="info@openpype.io"
LABEL description="Docker Image to build and run AYON under Ubuntu 20.04"
LABEL org.opencontainers.image.name="ynput/desktop"
LABEL org.opencontainers.image.title="AYON Desktop Docker Image"
LABEL description="Docker Image to build and run AYON Launcher under Ubuntu"
LABEL org.opencontainers.image.name="ynput/ayon-launcher"
LABEL org.opencontainers.image.title="AYON Launcher Docker Image"
LABEL org.opencontainers.image.url="https://ayon.ynput.io/"
LABEL org.opencontainers.image.source="https://github.com/ynput/OpenPype"
LABEL org.opencontainers.image.source="https://github.com/ynput/ayon-launcher"
LABEL org.opencontainers.image.documentation="https://ayon.ynput.io"
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.version=$VERSION
Expand Down Expand Up @@ -48,7 +47,7 @@ RUN apt-get update \
SHELL ["/bin/bash", "-c"]


RUN mkdir /opt/ayon
RUN mkdir /opt/ayon-launcher

# download and install pyenv
RUN curl https://pyenv.run | bash \
Expand All @@ -61,22 +60,19 @@ RUN curl https://pyenv.run | bash \
RUN source $HOME/init_pyenv.sh \
&& pyenv install ${PYTHON_VERSION}

COPY . /opt/ayon/
COPY . /opt/ayon-launcher/

RUN chmod +x /opt/ayon/tools/create_env.sh && chmod +x /opt/ayon/tools/build.sh
RUN chmod +x /opt/ayon-launcher/tools/make.sh

WORKDIR /opt/ayon
WORKDIR /opt/ayon-launcher

# set local python version
RUN cd /opt/ayon \
RUN cd /opt/ayon-launcher \
antirotor marked this conversation as resolved.
Show resolved Hide resolved
&& source $HOME/init_pyenv.sh \
&& pyenv local ${PYTHON_VERSION}

# fetch third party tools/libraries
# build launcher and installer
RUN source $HOME/init_pyenv.sh \
&& ./tools/create_env.sh \
&& ./tools/fetch_thirdparty_libs.sh

# build ayon desktop
RUN source $HOME/init_pyenv.sh \
&& bash ./tools/build.sh
&& ./tools/make.sh create-env \
&& ./tools/make.sh install-runtime \
&& ./tools/make.sh build-make-installer
35 changes: 16 additions & 19 deletions Dockerfile.centos7
antirotor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Build AYON desktop docker image
# Build AYON launcher docker image
FROM centos:7 AS builder
ARG PYTHON_VERSION=3.9.12

LABEL description="Docker Image to build and run AYON under Ubuntu 20.04"
LABEL org.opencontainers.image.name="ynput/desktop"
LABEL org.opencontainers.image.title="AYON Desktop Docker Image"
LABEL description="Docker Image to build and run AYON Launcher under Centos 7"
LABEL org.opencontainers.image.name="ynput/ayon-launcher"
LABEL org.opencontainers.image.title="AYON Launcher Docker Image"
LABEL org.opencontainers.image.url="https://ayon.ynput.io/"
LABEL org.opencontainers.image.source="https://github.com/ynput/OpenPype"
LABEL org.opencontainers.image.source="https://github.com/ynput/ayon-launcher"
LABEL org.opencontainers.image.documentation="https://ayon.ynput.io"
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.version=$VERSION
Expand Down Expand Up @@ -60,10 +60,7 @@ RUN git clone -b 0.17.0 --single-branch https://github.com/NixOS/patchelf.git .
&& make \
&& make install

RUN mkdir /opt/ayon
# RUN useradd -m pype
# RUN chown pype /opt/ayon
# USER pype
RUN mkdir /opt/ayon-launcher

RUN curl https://pyenv.run | bash
# ENV PYTHON_CONFIGURE_OPTS --enable-shared
Expand All @@ -74,34 +71,34 @@ RUN echo 'export PATH="$HOME/.pyenv/bin:$PATH"'>> $HOME/.bashrc \
&& echo 'eval "$(pyenv init --path)"' >> $HOME/.bashrc
RUN source $HOME/.bashrc && pyenv install ${PYTHON_VERSION}

COPY . /opt/ayon/
RUN rm -rf /opt/ayon/.poetry || echo "No Poetry installed yet."
COPY . /opt/ayon-launcher/
RUN rm -rf /opt/ayon-launcher/.poetry || echo "No Poetry installed yet."
# USER root
# RUN chown -R pype /opt/ayon
RUN chmod +x /opt/ayon/tools/create_env.sh && chmod +x /opt/ayon/tools/build.sh
# RUN chown -R pype /opt/ayon-launcher
RUN chmod +x /opt/ayon-launcher/tools/make.sh

# USER pype

WORKDIR /opt/ayon
WORKDIR /opt/ayon-launcher

RUN cd /opt/ayon \
RUN cd /opt/ayon-launcher \
&& source $HOME/.bashrc \
&& pyenv local ${PYTHON_VERSION}

RUN source $HOME/.bashrc \
&& ./tools/create_env.sh
&& ./tools/make.sh create-env
antirotor marked this conversation as resolved.
Show resolved Hide resolved

RUN source $HOME/.bashrc \
&& ./tools/fetch_thirdparty_libs.sh
&& ./tools/make.sh install-runtime

RUN source $HOME/.bashrc \
&& bash ./tools/build.sh
&& bash ./tools/make.sh build-make-installer

RUN cp /usr/lib64/libffi* ./build/exe.linux-x86_64-3.9/lib \
&& cp /usr/lib64/libssl* ./build/exe.linux-x86_64-3.9/lib \
&& cp /usr/lib64/libcrypto* ./build/exe.linux-x86_64-3.9/lib \
&& cp /root/.pyenv/versions/${PYTHON_VERSION}/lib/libpython* ./build/exe.linux-x86_64-3.9/lib \
&& cp /usr/lib64/libxcb* ./build/exe.linux-x86_64-3.9/vendor/python/PySide2/Qt/lib

RUN cd /opt/ayon \
RUN cd /opt/ayon-launcher \
rm -rf ./vendor/bin
26 changes: 11 additions & 15 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ ARG PYTHON_VERSION=3.9.12
ARG BUILD_DATE
ARG VERSION

LABEL maintainer="info@openpype.io"
LABEL description="Docker Image to build and run OpenPype under Ubuntu 20.04"
LABEL org.opencontainers.image.name="ynput/desktop"
LABEL org.opencontainers.image.title="AYON Desktop Docker Image"
LABEL description="Docker Image to build and run AYON Launcher under Debian"
LABEL org.opencontainers.image.name="ynput/ayon-launcher"
LABEL org.opencontainers.image.title="AYON Launcher Docker Image"
LABEL org.opencontainers.image.url="https://ayon.ynput.io/"
LABEL org.opencontainers.image.source="https://github.com/ynput/OpenPype"
LABEL org.opencontainers.image.source="https://github.com/ynput/ayon-launcher"
LABEL org.opencontainers.image.documentation="https://ayon.ynput.io"
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.version=$VERSION
Expand Down Expand Up @@ -60,22 +59,19 @@ RUN curl https://pyenv.run | bash \
RUN source $HOME/init_pyenv.sh \
&& pyenv install ${PYTHON_VERSION}

COPY . /opt/ayon/
COPY . /opt/ayon-launcher/

RUN chmod +x /opt/ayon/tools/create_env.sh && chmod +x /opt/ayon/tools/build.sh
RUN chmod +x /opt/ayon-launcher/tools/make.sh

WORKDIR /opt/ayon
WORKDIR /opt/ayon-launcher

# set local python version
RUN cd /opt/ayon \
&& source $HOME/init_pyenv.sh \
&& pyenv local ${PYTHON_VERSION}

# fetch third party tools/libraries
# build launcher and installer
RUN source $HOME/init_pyenv.sh \
&& ./tools/create_env.sh \
&& ./tools/fetch_thirdparty_libs.sh

# build ayon desktop
RUN source $HOME/init_pyenv.sh \
&& bash ./tools/build.sh
&& ./tools/make.sh create-env \
&& ./tools/make.sh install-runtime \
&& ./tools/make.sh build-make-installer
87 changes: 87 additions & 0 deletions Dockerfile.rocky9
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Build AYON launcher docker image
FROM rockylinux:9 AS builder
ARG PYTHON_VERSION=3.9.16

LABEL description="Docker Image to build and run AYON Launcher under RockyLinux 9"
LABEL org.opencontainers.image.name="ynput/ayon-launcher"
LABEL org.opencontainers.image.title="AYON Launcher Docker Image"
LABEL org.opencontainers.image.url="https://ayon.ynput.io/"
LABEL org.opencontainers.image.source="https://github.com/ynput/ayon-launcher"
LABEL org.opencontainers.image.documentation="https://ayon.ynput.io"
LABEL org.opencontainers.image.created=$BUILD_DATE
LABEL org.opencontainers.image.version=$VERSION


USER root

# update base
RUN dnf install -y dnf-plugins-core \
&& dnf -y update \
&& dnf clean all

# add tools we need
RUN dnf -y install \
bash \
which \
git \
make \
cmake \
wget \
gcc \
zlib-devel \
bzip2 \
bzip2-devel \
readline-devel \
sqlite sqlite-devel \
openssl-devel \
openssl-libs \
tk-devel libffi-devel \
automake \
autoconf \
patch \
ncurses \
ncurses-devel \
qt5-qtbase-devel \
xcb-util-wm \
xcb-util-renderutil \
&& dnf clean all

RUN mkdir /opt/ayon-launcher

RUN curl https://pyenv.run | bash
# ENV PYTHON_CONFIGURE_OPTS --enable-shared

RUN echo 'export PATH="$HOME/.pyenv/bin:$PATH"'>> $HOME/.bashrc \
&& echo 'eval "$(pyenv init -)"' >> $HOME/.bashrc \
&& echo 'eval "$(pyenv virtualenv-init -)"' >> $HOME/.bashrc \
&& echo 'eval "$(pyenv init --path)"' >> $HOME/.bashrc
RUN source $HOME/.bashrc && pyenv install ${PYTHON_VERSION}

COPY . /opt/ayon-launcher/
RUN rm -rf /opt/ayon-launcher/.poetry || echo "No Poetry installed yet."
# USER root
# RUN chown -R pype /opt/ayon-launcher
RUN chmod +x /opt/ayon-launcher/tools/make.sh

# USER pype

WORKDIR /opt/ayon-launcher

RUN cd /opt/ayon-launcher \
&& source $HOME/.bashrc \
&& pyenv local ${PYTHON_VERSION}

RUN source $HOME/.bashrc \
&& ./tools/make.sh create-env

RUN source $HOME/.bashrc \
&& ./tools/make.sh install-runtime

RUN source $HOME/.bashrc \
&& bash ./tools/make.sh build-make-installer

RUN cp /usr/lib64/libffi* ./build/output/lib \
&& cp /usr/lib64/libssl* ./build/output/lib \
&& cp /usr/lib64/libcrypto* ./build/output/lib \
&& cp /root/.pyenv/versions/${PYTHON_VERSION}/lib/libpython* ./build/output/lib \
&& cp /usr/lib64/libxcb* ./build/output/lib
35 changes: 16 additions & 19 deletions tools/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ realpath () {
}

create_container () {
if [ ! -f "$openpype_root/build/docker-image.id" ]; then
if [ ! -f "$launcher_root/build/docker-image.id" ]; then
echo -e "${BIRed}!!!${RST} Docker command failed, cannot find image id."
exit 1
fi
local id=$(<"$openpype_root/build/docker-image.id")
local id=$(<"$launcher_root/build/docker-image.id")
echo -e "${BIYellow}---${RST} Creating container from $id ..."
cid="$(docker create $id bash)"
if [ $? -ne 0 ] ; then
Expand All @@ -36,18 +36,18 @@ create_container () {

retrieve_build_log () {
create_container
echo -e "${BIYellow}***${RST} Copying build log to ${BIWhite}$openpype_root/build/build.log${RST}"
docker cp "$cid:/opt/openpype/build/build.log" "$openpype_root/build"
echo -e "${BIYellow}***${RST} Copying build log to ${BIWhite}$launcher_root/build/build.log${RST}"
docker cp "$cid:/opt/ayon-launcher/build/build.log" "$launcher_root/build"
}

openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
launcher_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))


if [ -z $1 ]; then
dockerfile="Dockerfile"
else
dockerfile="Dockerfile.$1"
if [ ! -f "$openpype_root/$dockerfile" ]; then
if [ ! -f "$launcher_root/$dockerfile" ]; then
echo -e "${BIRed}!!!${RST} Dockerfile for specifed platform ${BIWhite}$1${RST} doesn't exist."
exit 1
else
Expand All @@ -57,18 +57,17 @@ fi

# Main
main () {
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
pushd "$openpype_root" > /dev/null || return > /dev/null
launcher_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
pushd "$launcher_root" > /dev/null || return > /dev/null

echo -e "${BIYellow}---${RST} Cleaning build directory ..."
rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null
rm -rf "$launcher_root/build" && mkdir "$launcher_root/build" > /dev/null

local version_command="import os;exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read());print(__version__);"
local openpype_version="$(python3 <<< ${version_command})"
local version_command="import os;exec(open(os.path.join('$launcher_root', 'version.py')).read());print(__version__);"
local launcher_version="$(python <<< ${version_command})"

echo -e "${BIGreen}>>>${RST} Running docker build ..."
# docker build --pull --no-cache -t pypeclub/openpype:$openpype_version .
docker build --pull --iidfile $openpype_root/build/docker-image.id --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$openpype_version -t pypeclub/openpype:$openpype_version -f $dockerfile .
docker build --pull --iidfile $launcher_root/build/docker-image.id --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg VERSION=$launcher_version -t ynput/ayon-launcher:$launcher_version -f $dockerfile .
if [ $? -ne 0 ] ; then
echo $?
echo -e "${BIRed}!!!${RST} Docker build failed."
Expand All @@ -79,12 +78,10 @@ main () {
echo -e "${BIGreen}>>>${RST} Copying build from container ..."
create_container
echo -e "${BIYellow}---${RST} Copying ..."
docker cp "$cid:/opt/openpype/build/exe.linux-x86_64-3.9" "$openpype_root/build"
docker cp "$cid:/opt/openpype/build/build.log" "$openpype_root/build"
if [ $? -ne 0 ] ; then
echo -e "${BIRed}!!!${RST} Copying failed."
return 1
fi
docker cp "$cid:/opt/ayon-launcher/build/output" "$launcher_root/build" || echo -e "${BIRed}!!!${RST} Copying build failed." && return $?
docker cp "$cid:/opt/ayon-launcher/build/build.log" "$launcher_root/build" || echo -e "${BIRed}!!!${RST} Copying log failed." && return $?
docker cp "$cid:/opt/ayon-launcher/build/metadata.json" "$launcher_root/build" || echo -e "${BIRed}!!!${RST} Copying json failed." && return $?
docker cp "$cid:/opt/ayon-launcher/build/installer" "$launcher_root/build" || echo -e "${BIRed}!!!${RST} Copying installer failed." && return $?

echo -e "${BIGreen}>>>${RST} Fixing user ownership ..."
local username="$(logname)"
Expand Down
Loading