Skip to content

Commit

Permalink
fix docker bind mount permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Jan 4, 2024
1 parent 7d638ed commit 9f234a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 3 additions & 4 deletions builders/Linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get -y update \
&& apt-get -y install sudo build-essential cmake ninja-build git clang clang-13 clang-format iwyu \
&& apt-get -y install sudo gosu build-essential cmake ninja-build git clang clang-13 clang-format iwyu \
libglx-mesa0 libglvnd-dev libxkbcommon-dev libxkbcommon-x11-0 libpulse-dev libxcb1 libx11-xcb1 libxcb-glx0 libxcb-cursor0 \
libxcb-icccm4 libxcb-image0 libxcb-render-util0 libxcb-keysyms1 libicu70 \
libvulkan-dev mesa-vulkan-drivers \
Expand All @@ -58,8 +58,7 @@ RUN echo "mediafx ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/mediafx && chmod 044
VOLUME /mediafx
WORKDIR /mediafx/build/Linux

COPY entrypoint.sh /entrypoint.sh
COPY entrypoint.sh xvfb.sh /entrypoint/

USER mediafx
ENTRYPOINT ["/usr/bin/xvfb-run", "--server-args", "-screen 0 640x480x24 -nolisten unix", "--error-file", "/dev/stderr", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint/entrypoint.sh"]
CMD ["/mediafx/builders/Linux/mediafx-build.sh"]
10 changes: 8 additions & 2 deletions builders/Linux/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env bash

sudo mkdir -p /mediafx/build/Linux && sudo chown mediafx /mediafx/build/ /mediafx/build/Linux
exec "$@"
OLD_UID=$(id -u mediafx)
NEW_UID=$(stat -c "%u" /mediafx/CMakeLists.txt)
if [ ! -z "$NEW_UID" -a "$NEW_UID" != "0" -a "$OLD_UID" != "$NEW_UID" ]; then
usermod -u "$NEW_UID" -o mediafx
fi

mkdir -p /mediafx/build/Linux && chown -R mediafx /mediafx/build/Linux
exec gosu mediafx /entrypoint/xvfb.sh "$@"
4 changes: 4 additions & 0 deletions builders/Linux/xvfb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

exec /usr/bin/xvfb-run --server-args="-screen 0 640x480x24 -nolisten unix" --error-file=/tmp/xvfb.err "$@"
[ -f /tmp/xvfb.err ] && cat /tmp/xvfb.err

0 comments on commit 9f234a2

Please sign in to comment.