hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | # Build the SPA, then serve the static bundle with Bun (which also reverse- |
| 2 | # proxies /api to the backend — see server.ts). No nginx: one runtime, one |
| 3 | # tool, same-origin preserved. |
| 4 | |
| 5 | FROM docker.io/oven/bun:1 AS build |
| 6 | WORKDIR /app |
| 7 | COPY package.json bun.lock ./ |
| 8 | RUN --mount=type=cache,target=/root/.bun/install/cache \ |
| 9 | bun install --frozen-lockfile |
| 10 | COPY . . |
| 11 | RUN bun run build |
| 12 | |
| 13 | FROM docker.io/oven/bun:1-slim AS serve |
| 14 | WORKDIR /app |
| 15 | # Only the built assets and the server script are needed at runtime; server.ts |
| 16 | # imports nothing but Bun built-ins, so there are no node_modules to copy. |
| 17 | COPY --from=build /app/dist ./dist |
| 18 | COPY server.ts ./server.ts |
| 19 | |
| 20 | # THE deployment defaults, and the only place they are written. server.ts reads |
| 21 | # all three from the environment and refuses to boot without them, compose's |
| 22 | # healthcheck asks the container for PORT instead of repeating a number, and the |
| 23 | # deploy pipeline reads the port back out of the running container. Override any |
| 24 | # of them in hezarfen_frontend.env — env_file wins over these image values. |
| 25 | # Nothing is EXPOSEd: the service runs with host networking, so it binds the |
| 26 | # host's interface directly and no port mapping exists. |
| 27 | ENV PORT=5173 \ |
| 28 | HOST=0.0.0.0 \ |
| 29 | BACKEND_ORIGIN=http://127.0.0.1:7656 |
| 30 | USER bun |
| 31 | |
| 32 | # Healthcheck lives in compose.yaml (podman's OCI image format ignores a |
| 33 | # Containerfile HEALTHCHECK). |
| 34 | CMD ["bun", "run", "server.ts"] |