x11 forwarding now works
This commit is contained in:
parent
19f92c5102
commit
12d081b9fc
26
Dockerfile
26
Dockerfile
@ -68,16 +68,6 @@ RUN apt-get -y install wget
|
|||||||
RUN /usr/bin/wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
|
RUN /usr/bin/wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
|
||||||
RUN tar -C /opt -xzf go1.19.1.linux-amd64.tar.gz
|
RUN tar -C /opt -xzf go1.19.1.linux-amd64.tar.gz
|
||||||
|
|
||||||
# install editors
|
|
||||||
WORKDIR "/"
|
|
||||||
ADD home template
|
|
||||||
RUN apt-get install -y vim
|
|
||||||
RUN mkdir -p /template/.vim/pack/plugins/start
|
|
||||||
RUN git clone https://www.github.com/fatih/vim-go.git /template/.vim/pack/plugins/start/vim-go
|
|
||||||
RUN git clone https://github.com/tpope/vim-fugitive /template/.vim/pack/plugins/start/fugitive
|
|
||||||
RUN git clone https://www.github.com/preservim/nerdtree.git /template/.vim/pack/plugins/start/nerdtree
|
|
||||||
RUN vim +GoInstallBinaries +qall
|
|
||||||
|
|
||||||
# install gaw
|
# install gaw
|
||||||
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get install -y libgtk-3-dev libcanberra-gtk3-module
|
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get install -y libgtk-3-dev libcanberra-gtk3-module
|
||||||
WORKDIR /toolsrc
|
WORKDIR /toolsrc
|
||||||
@ -163,6 +153,18 @@ WORKDIR /toolsrc
|
|||||||
RUN --mount=type=secret,id=user --mount=type=secret,id=token git clone https://$(cat /run/secrets/user):$(cat /run/secrets/token)@git.broccolimicro.io/Broccoli/pr.git
|
RUN --mount=type=secret,id=user --mount=type=secret,id=token git clone https://$(cat /run/secrets/user):$(cat /run/secrets/token)@git.broccolimicro.io/Broccoli/pr.git
|
||||||
RUN cp -r pr/* /opt/cad/bin
|
RUN cp -r pr/* /opt/cad/bin
|
||||||
|
|
||||||
|
RUN apt-get -y install sudo
|
||||||
|
|
||||||
|
# install editors
|
||||||
|
WORKDIR "/"
|
||||||
|
ADD home template
|
||||||
|
RUN apt-get install -y vim
|
||||||
|
RUN mkdir -p /template/.vim/pack/plugins/start
|
||||||
|
RUN git clone https://www.github.com/fatih/vim-go.git /template/.vim/pack/plugins/start/vim-go
|
||||||
|
RUN git clone https://github.com/tpope/vim-fugitive /template/.vim/pack/plugins/start/fugitive
|
||||||
|
RUN git clone https://www.github.com/preservim/nerdtree.git /template/.vim/pack/plugins/start/nerdtree
|
||||||
|
RUN vim +GoInstallBinaries +qall
|
||||||
|
|
||||||
# Clean up source code folder
|
# Clean up source code folder
|
||||||
#RUN rm -rf /toolsrc
|
#RUN rm -rf /toolsrc
|
||||||
|
|
||||||
@ -176,11 +178,13 @@ ENV USER "bcli"
|
|||||||
ENV USER_ID "1000"
|
ENV USER_ID "1000"
|
||||||
ENV GROUP_ID "1000"
|
ENV GROUP_ID "1000"
|
||||||
ENV MEMBERS ""
|
ENV MEMBERS ""
|
||||||
|
ENV XAUTH_TOKEN ""
|
||||||
|
|
||||||
RUN echo "HELLO!?!?1"
|
|
||||||
CMD exec /bin/bash -c "echo \"$MEMBERS\" | sed 's/ /\n/g' | xargs -n 2 /usr/sbin/groupadd -g; \
|
CMD exec /bin/bash -c "echo \"$MEMBERS\" | sed 's/ /\n/g' | xargs -n 2 /usr/sbin/groupadd -g; \
|
||||||
/usr/sbin/useradd -u $USER_ID -g $USER $USER; \
|
/usr/sbin/useradd -u $USER_ID -g $USER $USER; \
|
||||||
echo \"$MEMBERS\" | sed 's/ [0-9]\+ /,/g' | sed 's/[0-9]\+ //g' | xargs -I{} /usr/sbin/usermod -aG {} $USER; \
|
echo \"$MEMBERS\" | sed 's/ [0-9]\+ /,/g' | sed 's/[0-9]\+ //g' | xargs -I{} /usr/sbin/usermod -aG {} $USER; \
|
||||||
cp -r /template /home/$USER; \
|
cp -r /template /home/$USER; \
|
||||||
|
xauth -f /home/$USER/.Xauthority add $XAUTH_TOKEN; \
|
||||||
chown -R $USER:$USER /home/$USER; \
|
chown -R $USER:$USER /home/$USER; \
|
||||||
|
/usr/sbin/usermod -p \$(openssl passwd -1 'bcli') $USER; \
|
||||||
trap : TERM INT; sleep infinity & wait"
|
trap : TERM INT; sleep infinity & wait"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
bcli() {
|
bcli() {
|
||||||
if [ "$1" = "up" ]; then
|
if [ "$1" = "up" ]; then
|
||||||
export MEMBERS="$(groups | sed 's/ /\n/g' | xargs -I{} getent group {} | sed 's/\([^:]*\):[^:]*:\([^:]*\):.*/\2 \1/g')"
|
export MEMBERS="$(groups | sed 's/ /\n/g' | xargs -I{} getent group {} | sed 's/\([^:]*\):[^:]*:\([^:]*\):.*/\2 \1/g')"
|
||||||
docker run --rm -d -v $HOME:/host -v "/opt/tech:/opt/cad/conf" --name "bcli-$USER" -h "bcli-$USER" -e USER=$USER -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -e DISPLAY=$DISPLAY -e MEMBERS="$MEMBERS" -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" public.ecr.aws/l5h5o6z4/broccoli-cli:latest > /dev/null
|
docker run --rm -d --net=host -v $HOME:/host -v "/opt/tech:/opt/cad/conf" --name "bcli-$USER" -h "bcli-$USER" -e USER=$USER -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -e DISPLAY=$DISPLAY -e MEMBERS="$MEMBERS" -e XAUTH_TOKEN="$(xauth list | sed 's/^[^:]*/localhost/g')" -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" public.ecr.aws/l5h5o6z4/broccoli-cli:latest > /dev/null
|
||||||
#docker run --rm -d -v $HOME:/host -v "${BCLI_TECH:/opt/tech}:/opt/cad/conf" --name "bcli-$USER" -h "bcli-$USER" -e USER=$USER -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" ${BCLI_IMAGE:-public.ecr.aws/l5h5o6z4/broccoli-cli:latest} > /dev/null
|
#docker run --rm -d -v $HOME:/host -v "${BCLI_TECH:/opt/tech}:/opt/cad/conf" --name "bcli-$USER" -h "bcli-$USER" -e USER=$USER -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -e DISPLAY=$DISPLAY -v "/tmp/.X11-unix:/tmp/.X11-unix:rw" ${BCLI_IMAGE:-public.ecr.aws/l5h5o6z4/broccoli-cli:latest} > /dev/null
|
||||||
echo "bcli-$USER started"
|
echo "bcli-$USER started"
|
||||||
elif [ "$1" = "down" ]; then
|
elif [ "$1" = "down" ]; then
|
||||||
@ -29,7 +29,7 @@ bcli() {
|
|||||||
if [[ "$PWD" = "$HOME/"* ]]; then
|
if [[ "$PWD" = "$HOME/"* ]]; then
|
||||||
WD="/host${PWD#$HOME}"
|
WD="/host${PWD#$HOME}"
|
||||||
fi
|
fi
|
||||||
docker exec -u $(id -u) -w $WD -it "bcli-$USER" /bin/bash
|
docker exec -u $(id -u) -w $WD -e DISPLAY=$DISPLAY -it "bcli-$USER" /bin/bash
|
||||||
else
|
else
|
||||||
if [ "$1" != "--help" ]; then
|
if [ "$1" != "--help" ]; then
|
||||||
echo "error: unrecognized command '$1'"
|
echo "error: unrecognized command '$1'"
|
||||||
|
0
home/.Xauthority
Normal file
0
home/.Xauthority
Normal file
Loading…
Reference in New Issue
Block a user