From 660be2d1d23c370302556363d342dd8bbb48558f Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 5 May 2021 17:30:49 +0200 Subject: [PATCH] resolve user and copying problems --- Dockerfile | 16 +++++++++------- tools/docker_build.sh | 22 ++++++++++++++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) mode change 100644 => 100755 tools/docker_build.sh diff --git a/Dockerfile b/Dockerfile index 2499b26278..5dfd3fc61f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ LABEL org.opencontainers.image.source="https://github.com/pypeclub/pype" USER root RUN yum -y update \ - && yum -y install epel-release centos-release-scl \ + && yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ + && yum -y install centos-release-scl \ && yum -y install \ bash \ which \ @@ -29,12 +30,13 @@ RUN yum -y update \ openssl-devel \ tk-devel libffi-devel \ qt5-qtbase-devel \ + patchelf \ && yum clean all RUN mkdir /opt/openpype -RUN useradd -m pype -RUN chown pype /opt/openpype -USER pype +# RUN useradd -m pype +# RUN chown pype /opt/openpype +# USER pype RUN curl https://pyenv.run | bash ENV PYTHON_CONFIGURE_OPTS --enable-shared @@ -45,11 +47,11 @@ RUN echo 'export PATH="$HOME/.pyenv/bin:$PATH"'>> $HOME/.bashrc \ RUN cat $HOME/.bashrc && source $HOME/.bashrc && pyenv install ${OPENPYPE_PYTHON_VERSION} COPY . /opt/openpype/ -USER root -RUN chown -R pype /opt/openpype +# USER root +# RUN chown -R pype /opt/openpype RUN chmod +x /opt/openpype/tools/create_env.sh && chmod +x /opt/openpype/tools/build.sh -USER pype +# USER pype WORKDIR /opt/openpype diff --git a/tools/docker_build.sh b/tools/docker_build.sh old mode 100644 new mode 100755 index d64ca9b60e..e3ce9a04c0 --- a/tools/docker_build.sh +++ b/tools/docker_build.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +# Colors for terminal + +RST='\033[0m' # Text Reset +BIGreen='\033[1;92m' # Green +BIYellow='\033[1;93m' # Yellow + ############################################################################## # Return absolute path # Globals: @@ -15,17 +21,25 @@ realpath () { # Main main () { - # Directories - openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))) pushd "$openpype_root" > /dev/null || return > /dev/null + echo -e "${BIYellow}---${RST} Cleaning build directory ..." + rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null + version_command="import os;exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read());print(__version__);" openpype_version="$(python3 <<< ${version_command})" + echo -e "${BIGreen}>>>${RST} Running docker build ..." docker build -t pypeclub/openpype:$openpype_version . - id="$(docker create pypeclub/openpype:$openpype_version)" - docker cp "$id:/opt/openpype/build.linux-x86-64-3.7" "$openpype_root/build" + + echo -e "${BIGreen}>>>${RST} Copying build from container ..." + echo -e "${BIYellow}---${RST} Creating container from pypeclub/openpype:$openpype_version ..." + id="$(docker create -ti pypeclub/openpype:$openpype_version bash)" + echo -e "${BIYellow}---${RST} Copying ..." + docker cp "$id:/opt/openpype/build/exe.linux-x86_64-3.7" "$openpype_root/build" + echo -e "${BIGreen}>>>${RST} All done, you can delete container:" + echo -e "${BIYellow}$id${RST}" } main