Merge pull request #6612 from penpot/niwinz-develop-devenv

🐛 Fix build issues on devenv
This commit is contained in:
Alejandro Alonso 2025-06-03 07:49:34 +02:00 committed by GitHub
commit 401fa823a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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