build: doker镜像构建时记录构建时间与gitcommit
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
- 镜像构建时会向项目目录内的version.json写入构建时间与commit-sha,并在镜像启动时输出日志 - 添加用于获取版本号的server api
This commit is contained in:
12
Dockerfile
12
Dockerfile
@ -32,10 +32,20 @@ WORKDIR /app
|
||||
# COPY .output folder
|
||||
COPY --from=build /app/.output ./
|
||||
|
||||
|
||||
ARG BUILD_TIME
|
||||
ARG GIT_COMMIT
|
||||
|
||||
RUN echo "{\"buildTime\":\"$BUILD_TIME\",\"gitCommit\":\"$GIT_COMMIT\"}" > /app/version.json
|
||||
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENV PORT=3000
|
||||
ENV NITRO_PRESET=node-server
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["node", "/app/server/index.mjs"]
|
||||
|
||||
Reference in New Issue
Block a user