diff --git a/docker/devenv/Dockerfile b/docker/devenv/Dockerfile index a7dea8c993..c36e75894d 100644 --- a/docker/devenv/Dockerfile +++ b/docker/devenv/Dockerfile @@ -260,10 +260,10 @@ RUN set -ex; \ mv /tmp/mc /usr/local/bin/; \ chmod +x /usr/local/bin/mc; -WORKDIR /home +WORKDIR /usr/local # Install Rust toolchain -ENV PATH=/home/cargo/bin:$PATH RUSTUP_HOME=/home/rustp CARGO_HOME=/home/cargo +ENV PATH=/usr/local/cargo/bin:$PATH RUSTUP_HOME=/usr/local/rustpo CARGO_HOME=/usr/local/cargo RUN set -eux; \ # Same steps as in Rust official Docker image https://github.com/rust-lang/docker-rust/blob/9f287282d513a84cb7c7f38f197838f15d37b6a9/1.81.0/bookworm/Dockerfile diff --git a/docker/devenv/files/bashrc b/docker/devenv/files/bashrc index c55b214c78..6dcc66f191 100644 --- a/docker/devenv/files/bashrc +++ b/docker/devenv/files/bashrc @@ -1,8 +1,5 @@ #!/usr/bin/env bash -export JAVA_OPTS=${JAVA_OPTS:-"-Xmx1000m -Xms200m"}; -EMSDK_QUIET=1 . /home/emsdk/emsdk_env.sh; - alias l='ls --color -GFlh' alias rm='rm -r' alias ls='ls --color -F' diff --git a/docker/devenv/files/entrypoint.sh b/docker/devenv/files/entrypoint.sh index 77486ebd6b..ba112dd61d 100755 --- a/docker/devenv/files/entrypoint.sh +++ b/docker/devenv/files/entrypoint.sh @@ -2,6 +2,18 @@ set -e +EMSDK_QUIET=1 . /usr/local/emsdk/emsdk_env.sh; + usermod -u ${EXTERNAL_UID:-1000} penpot; +cp /root/.bashrc /home/penpot/.bashrc +cp /root/.vimrc /home/penpot/.vimrc +cp /root/.tmux.conf /home/penpot/.tmux.conf + +chown -R penpot:users /home/penpot +rsync -ar --chown=penpot:users /usr/local/cargo/ /home/penpot/.cargo/ + +export PATH="/home/penpot/.cargo/bin:$PATH" +export CARGO_HOME="/home/penpot/.cargo" + exec "$@" diff --git a/docker/devenv/files/init.sh b/docker/devenv/files/init.sh index 55dbfeeff8..2f809ebbb9 100755 --- a/docker/devenv/files/init.sh +++ b/docker/devenv/files/init.sh @@ -1,11 +1,5 @@ #!/usr/bin/env bash -cp /root/.bashrc /home/penpot/.bashrc -cp /root/.vimrc /home/penpot/.vimrc -cp /root/.tmux.conf /home/penpot/.tmux.conf -chown -R penpot:users /home/penpot -chown -R penpot:users /home/cargo; - set -e nginx tail -f /dev/null diff --git a/frontend/scripts/build b/frontend/scripts/build index 46b5985faa..71ff300451 100755 --- a/frontend/scripts/build +++ b/frontend/scripts/build @@ -2,11 +2,8 @@ # NOTE: this script should be called from the parent directory to # properly work. -set -ex - export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no}; export INCLUDE_WASM=${BUILD_WASM:-yes}; - export CURRENT_VERSION=$1; export BUILD_DATE=$(date -R); export CURRENT_HASH=${CURRENT_HASH:-$(git rev-parse --short HEAD)}; @@ -17,6 +14,11 @@ export TS=$(date +%s); # performant code on macros (example: rumext) export NODE_ENV=production; +echo "Current path:" +echo $PATH + +set -ex + corepack enable; corepack install || exit 1; yarn install || exit 1; diff --git a/manage.sh b/manage.sh index afd3fd201f..d89a4f3e77 100755 --- a/manage.sh +++ b/manage.sh @@ -34,7 +34,7 @@ function build-devenv { fi # docker build -t $DEVENV_IMGNAME:latest . - docker buildx build --platform linux/amd64,linux/arm64 --push -t $DEVENV_IMGNAME:latest .; + docker buildx build --platform linux/amd64 --push -t $DEVENV_IMGNAME:latest .; docker pull $DEVENV_IMGNAME:latest; popd; @@ -104,6 +104,21 @@ function run-devenv-shell { penpot-devenv-main sudo -EH -u penpot bash; } +function run-devenv-isolated-shell { + docker volume create ${DEVENV_PNAME}_user_data; + docker run -ti --rm \ + --mount source=${DEVENV_PNAME}_user_data,type=volume,target=/home/penpot/ \ + --mount source=`pwd`,type=bind,target=/home/penpot/penpot \ + -e EXTERNAL_UID=$CURRENT_USER_ID \ + -e BUILD_STORYBOOK=$BUILD_STORYBOOK \ + -e BUILD_WASM=$BUILD_WASM \ + -e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \ + -e JAVA_OPTS="$JAVA_OPTS" \ + -w /home/penpot/penpot/$1 \ + $DEVENV_IMGNAME:latest sudo -EH -u penpot bash +} + + function build { echo ">> build start: $1" local version=$(print-current-version); @@ -233,6 +248,7 @@ function usage { echo "- drop-devenv Remove the development oriented docker compose containers, volumes and clean images." echo "- run-devenv Attaches to the running devenv container and starts development environment" echo "- run-devenv-shell Attaches to the running devenv container and starts a bash shell." + echo "- isolated-shell Starts a bash shell in a new devenv container." echo "- log-devenv Show logs of the running devenv docker compose service." echo "" echo "- build-bundle Build all bundles (frontend, backend and exporter)." @@ -280,6 +296,11 @@ case $1 in run-devenv-shell) run-devenv-shell ${@:2} ;; + + isolated-shell) + run-devenv-isolated-shell ${@:2} + ;; + stop-devenv) stop-devenv ${@:2} ;;