update install

This commit is contained in:
aichy 2022-09-28 17:33:48 +08:00
parent 01094e3e2c
commit a369e5ce96
4 changed files with 14 additions and 4 deletions

View File

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

View File

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

View File

@ -9,7 +9,7 @@ data:
i18n:
bundle_dir: "/data/i18n"
swaggerui:
show: false
show: true
protocol: http
host: 127.0.0.1
address: ':80'

5
script/entrypoint.sh Executable file
View File

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