resolve user and copying problems

This commit is contained in:
Ondrej Samohel 2021-05-05 17:30:49 +02:00
parent 54c72435e6
commit 660be2d1d2
2 changed files with 27 additions and 11 deletions

View file

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

22
tools/docker_build.sh Normal file → Executable file
View file

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