Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update install

aichya369e5ce96e0
diff --git a/Dockerfile b/Dockerfile
index fd6480c9..dbd4de8e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,7 +24,6 @@ ENV GOPRIVATE git.backyard.segmentfault.com
COPY . ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY --from=node-builder /tmp/build ${BUILD_DIR}/web/html
-CMD ls -al ${BUILD_DIR}/web/html
RUN make clean build && \
cp answer /usr/bin/answer && \
mkdir -p /tmp/cache && chmod 777 /tmp/cache && \
@@ -32,7 +31,6 @@ RUN make clean build && \
FROM debian:bullseye
-
ENV TZ "Asia/Shanghai"
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
&& sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list \
@@ -46,6 +44,8 @@ COPY --from=golang-builder /data /data
VOLUME /data
COPY --from=golang-builder /usr/bin/answer /usr/bin/answer
+COPY /script/entrypoint.sh /entrypoint.sh
+RUN chmod 755 /entrypoint.sh
EXPOSE 80
-ENTRYPOINT ["dumb-init", "/usr/bin/answer","init", "&&", "/usr/bin/answer", "-c", "/data/config.yaml"]
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/cmd/answer/main.go b/cmd/answer/main.go
index 92badecb..138fd57a 100644
--- a/cmd/answer/main.go
+++ b/cmd/answer/main.go
@@ -50,6 +50,11 @@ func main() {
cli.InitConfig()
return
}
+ if len(args) >= 3 {
+ if args[0] == "run" && args[1] == "-c" {
+ confFlag = args[2]
+ }
+ }
log.SetLogger(zap.NewLogger(
log.ParseLevel(logLevel), zap.WithName(Name), zap.WithPath(logPath), zap.WithCallerFullPath()))
diff --git a/configs/config.yaml b/configs/config.yaml
index db7b7c09..d27c801c 100644
--- a/configs/config.yaml
+++ b/configs/config.yaml
@@ -9,7 +9,7 @@ data:
i18n:
bundle_dir: "/data/i18n"
swaggerui:
- show: false
+ show: true
protocol: http
host: 127.0.0.1
address: ':80'
diff --git a/script/entrypoint.sh b/script/entrypoint.sh
new file mode 100755
index 00000000..4e761961
--- /dev/null
+++ b/script/entrypoint.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+if [ ! -f "/data/config.yaml" ]; then
+ /usr/bin/answer init
+fi
+/usr/bin/answer run -c /data/config.yaml