Files
edgeever/Dockerfile
T
Dariusz Korytoandtianma-if df22f55d1c feat(docker): report image build metadata in System information (#602)
Docker instances reported most deployment fields as unknown. Report how
and when the container image was built, separately from how the
instance was deployed:

- Dockerfile: optional EDGE_EVER_BUILD_CREATED_AT, EDGE_EVER_BUILD_TRIGGER
  and EDGE_EVER_BUILD_METHOD build args, empty by default.
- /api/health (self-hosted-bun only): optional buildCreatedAt and
  buildProvenance. deploymentVersionCreatedAt and deployment keep their
  meaning and stay runtime-supplied; Cloudflare responses are unchanged.
- docker-image.yml: official images record the build time and their
  provenance. Draft-release builds dispatched with release_tag are
  github_release, main pushes main_push, other dispatches manual.
  The container test checks the health response for a metadata build
  with runtime overrides and for a default self-build; the post-publish
  audit checks the published image.
- Add an explicit `docker` deployment method. It is never inferred from
  the runtime, and the registry source still comes only from
  EDGE_EVER_CONTAINER_IMAGE.
- Web/desktop show "Image built at" and "Image build source" for Docker;
  Android shows "Image built at". Older clients ignore the new fields.
- Document the build args and runtime variables in both Docker guides.

Co-authored-by: tianma-if <yingwaizhiying@gmail.com>
2026-10-18 11:43:41 +08:00

74 lines
2.9 KiB
Docker

# syntax=docker/dockerfile:1.7
FROM oven/bun:1.3.14-alpine AS manifests
WORKDIR /app
COPY package.json bun.lock bunfig.toml ./
COPY apps/api/package.json apps/api/package.json
COPY apps/desktop/package.json apps/desktop/package.json
COPY apps/extension/package.json apps/extension/package.json
COPY apps/mobile/package.json apps/mobile/package.json
COPY apps/site/package.json apps/site/package.json
COPY apps/web/package.json apps/web/package.json
COPY packages/client/package.json packages/client/package.json
COPY packages/plugin-api/package.json packages/plugin-api/package.json
COPY packages/public-network/package.json packages/public-network/package.json
COPY packages/shared/package.json packages/shared/package.json
COPY packages/wrangler/package.json packages/wrangler/package.json
COPY patches patches
FROM manifests AS dependencies
RUN bun install --frozen-lockfile \
--filter edgeever \
--filter @edgeever/api \
--filter @edgeever/public-network \
--filter @edgeever/web
FROM dependencies AS build
COPY apps/api apps/api
COPY apps/web apps/web
COPY packages packages
COPY docs docs
COPY release-summary.json release-summary.json
COPY scripts/self-hosted-config.mjs scripts/self-hosted-secrets.mjs scripts/self-hosted-server.mjs scripts/
COPY tsconfig.json ./
RUN bun run build:web && bun run build:self-hosted
FROM oven/bun:1.3.14-alpine AS runtime
WORKDIR /app
ARG EDGE_EVER_BUILD_ID=unknown
# Image build metadata for System information. Self-built images leave these
# empty, which the instance reports as unknown. They describe how the image was
# produced, not how it was deployed; set EDGE_EVER_DEPLOYMENT_* at runtime for that.
ARG EDGE_EVER_BUILD_CREATED_AT=
ARG EDGE_EVER_BUILD_TRIGGER=
ARG EDGE_EVER_BUILD_METHOD=
ENV NODE_ENV=production \
EDGE_EVER_BUILD_ID=${EDGE_EVER_BUILD_ID} \
EDGE_EVER_BUILD_CREATED_AT=${EDGE_EVER_BUILD_CREATED_AT} \
EDGE_EVER_BUILD_TRIGGER=${EDGE_EVER_BUILD_TRIGGER} \
EDGE_EVER_BUILD_METHOD=${EDGE_EVER_BUILD_METHOD} \
EDGE_EVER_DATA_DIR=/data \
EDGE_EVER_WEB_DIR=/app/apps/web/dist \
PORT=8787
LABEL org.opencontainers.image.title="EdgeEver" \
org.opencontainers.image.description="Self-hosted notes and knowledge management" \
org.opencontainers.image.licenses="AGPL-3.0-only"
COPY --from=build /app/dist/self-hosted/self-hosted-server.js ./scripts/self-hosted-server.js
COPY --from=build /app/apps/web/dist ./apps/web/dist
COPY migrations ./migrations
COPY LICENSE ./LICENSE
# NAS/GUI upgrades often keep the v1.62 command bun scripts/self-hosted-server.mjs.
RUN mkdir -p /data \
&& ln -s self-hosted-server.js /app/scripts/self-hosted-server.mjs \
&& chown -R bun:bun /data
USER bun
VOLUME ["/data"]
EXPOSE 8787
STOPSIGNAL SIGTERM
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD bun -e "const r=await fetch('http://127.0.0.1:8787/api/health');if(!r.ok)process.exit(1)"
CMD ["bun", "scripts/self-hosted-server.js"]