Skip to content

Commit

Permalink
[Build] Revised scripts for new project arch and make GUI on as defau…
Browse files Browse the repository at this point in the history
…lt. (flomesh-io#29)

Revised scripts for new project arch and make GUI on as default.
Remove unneccesary daemon reload in RPM package.
Fix working directory issue while building alpine image.
Remove unused files from rpm spec file.

Co-authored-by: Kevein Liu <kevein@flomesh.cn>
  • Loading branch information
khas-flomesh and keveinliu authored Oct 18, 2021
1 parent 0939bff commit f03d2d1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ RUN rm -fr pipy/build \
&& npm install \
&& npm run build \
&& cd build \
&& cmake -DPIPY_GUI=OFF -DPIPY_TUTORIAL=ON -DCMAKE_BUILD_TYPE=Release .. \
&& export CI_COMMIT_SHA \
&& export CI_COMMIT_TAG=${VERSION}-${REVISION} \
&& export CI_COMMIT_DATE \
&& cmake -DPIPY_GUI=ON -DPIPY_TUTORIAL=ON -DCMAKE_BUILD_TYPE=Release .. \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& mkdir ${pkg_confdir} \
&& cp /pipy/bin/pipy ${pkg_bindir} \
Expand All @@ -43,7 +46,6 @@ COPY --from=builder /pipy/bin/pipy /usr/local/bin/pipy
COPY --from=builder /etc/pipy /etc/pipy
RUN apk add --no-cache ca-certificates libstdc++ libcap su-exec tar curl busybox-extras iptables tzdata socat logrotate
RUN adduser -Su 1340 pipy \
&& setcap cap\_net\_admin=eip /usr/local/bin/pipy \
&& chmod -R g=u /usr/local/bin/pipy /etc/pipy \
&& chown -R pipy:0 /usr/local/bin/pipy /etc/pipy

Expand Down
9 changes: 5 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST_CASE=all
IMAGE_TAG=${IMAGE_TAG:-latest}
DOCKERFILE=${DOCKERFILE:-Dockerfile}

PIPY_GUI=${PIPY_GUI:-OFF}
PIPY_GUI=${PIPY_GUI:-ON}
PIPY_TUTORIAL=${PIPY_TUTORIAL:-ON}

##### End Default environment variables #########
Expand Down Expand Up @@ -137,7 +137,7 @@ function build() {
git pull origin $BRANCH
export CC=clang
export CXX=clang++
cd ${PIPY_DIR}/gui
cd ${PIPY_DIR}
npm install
npm run build
mkdir ${PIPY_DIR}/build 2>&1 > /dev/null || true
Expand Down Expand Up @@ -210,17 +210,18 @@ if ! $TEST_ONLY && $BUILD_RPM; then
fi

if ! $TEST_ONLY && $BUILD_CONTAINER; then
cd $PIPY_DIR
if [ "x"$RELEASE_VERSION != "x" ]; then
IMAGE_TAG=$RELEASE_VERSION
sudo docker build --rm -t pipy-oss:$IMAGE_TAG \
--build-arg VERSION=$VERSION \
--build-arg REVISION=$REVISION \
--build-arg COMMIT_ID=$COMMIT_ID \
--build-arg COMMIT_DATE="$COMMIT_DATE" \
-f $DOCKERFILE $PIPY_DIR
-f $DOCKERFILE .

else
sudo docker build --rm -t pipy-oss:$IMAGE_TAG -f $DOCKERFILE $PIPY_DIR
sudo docker build --rm -t pipy-oss:$IMAGE_TAG -f $DOCKERFILE .
fi
fi

Expand Down
9 changes: 1 addition & 8 deletions rpm/pipy.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cd pipy
npm install
npm run build
cd build
CXX=clang++ CC=clang cmake3 -DPIPY_GUI=OFF -DPIPY_TUTORIAL=ON -DCMAKE_BUILD_TYPE=Release ..
CXX=clang++ CC=clang cmake3 -DPIPY_GUI=ON -DPIPY_TUTORIAL=ON -DCMAKE_BUILD_TYPE=Release ..
make -j$(getconf _NPROCESSORS_ONLN)

%preun
Expand All @@ -47,11 +47,9 @@ getent passwd pipy >/dev/null || useradd -r -g pipy -G pipy -d /etc/pipy -s /sbi
mkdir -p %{buildroot}%{prefix}/bin
mkdir -p %{buildroot}/etc/pipy
cp pipy/bin/pipy %{buildroot}%{prefix}/bin
cp -r pipy/etc/* %{buildroot}/etc/
chrpath --delete %{buildroot}%{prefix}/bin/pipy

%post
systemctl daemon-reload

%postun
if [ $1 -eq 0 ] ; then
Expand All @@ -63,10 +61,5 @@ rm -rf %{buildroot}

%files
%attr(755, pipy, pipy) %{prefix}/bin/pipy
%attr(755, pipy, pipy) /etc/pipy/
%attr(644, root, root) /etc/systemd/system/pipy.service
%attr(644, root, root) /etc/sysconfig/pipy

%config /etc/pipy/pipy.js

%changelog

0 comments on commit f03d2d1

Please sign in to comment.