diff --git a/Makefile b/Makefile index 02f21450d..2f8fc0e1b 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,7 @@ package-dashboard-rpm: --iteration $(iteration) \ --description 'Apache APISIX Dashboard is designed to make it as easy as possible for users to operate Apache APISIX through a frontend interface.' \ --license "ASL 2.0" \ + --after-install ${PWD}/deps/after-install.sh \ -C ${PWD}/build/rpm/output/apisix/dashboard/ \ -p ${PWD}/output/ \ --url 'https://github.com/apache/apisix-dashboard' diff --git a/deps/after-install.sh b/deps/after-install.sh new file mode 100644 index 000000000..14febe73e --- /dev/null +++ b/deps/after-install.sh @@ -0,0 +1,3 @@ +systemctl daemon-reload \ +&& systemctl enable apisix-dashboard.service \ +&& chown -R nobody: /usr/local/apisix/dashboard/logs diff --git a/deps/apisix-dashboard.service b/deps/apisix-dashboard.service new file mode 100644 index 000000000..4c50105b7 --- /dev/null +++ b/deps/apisix-dashboard.service @@ -0,0 +1,13 @@ +[Unit] +Description=APACHE APISIX Dashboard Service +After=network.target + +[Service] +Type=simple +User=nobody +Restart=on-failure +RestartSec=5s +ExecStart=/usr/bin/manager-api -p /usr/local/apisix/dashboard + +[Install] +WantedBy=multi-user.target diff --git a/dockerfiles/Dockerfile.dashboard.rpm b/dockerfiles/Dockerfile.dashboard.rpm index d49ce7d72..3a55d89ca 100644 --- a/dockerfiles/Dockerfile.dashboard.rpm +++ b/dockerfiles/Dockerfile.dashboard.rpm @@ -6,6 +6,8 @@ ARG dashboard_repo="https://github.com/apache/apisix-dashboard.git" FROM ${image_base}:${image_tag} +COPY ./deps/apisix-dashboard.service /tmp/build/output/apisix/dashboard/usr/lib/systemd/system/apisix-dashboard.service + RUN set -x \ # install dependency && yum install -y wget curl git which gcc make \ @@ -20,8 +22,9 @@ ARG checkout_v ARG iteration ARG dashboard_repo RUN set -x \ - && mkdir -p /tmp/build/output/apisix/dashboard/usr/bin/ \ - && mkdir -p /tmp/build/output/apisix/dashboard/usr/local/apisix/dashboard/ \ + && mkdir -pv /tmp/build/output/apisix/dashboard/usr/bin/ \ + && mkdir -pv /tmp/build/output/apisix/dashboard/usr/local/apisix/dashboard/ \ + && mkdir -pv /tmp/build/output/apisix/dashboard/usr/lib/systemd/system \ # config golang && export GO111MODULE=on \ && export GOROOT=/usr/local/go \