forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

Containerfile34 lines, 1.4 KiBHistoryRawDownload
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
5FROM docker.io/oven/bun:1 AS build
6WORKDIR /app
7COPY package.json bun.lock ./
8RUN --mount=type=cache,target=/root/.bun/install/cache \
9 bun install --frozen-lockfile
10COPY . .
11RUN bun run build
12
13FROM docker.io/oven/bun:1-slim AS serve
14WORKDIR /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.
17COPY --from=build /app/dist ./dist
18COPY 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.
27ENV PORT=5173 \
28 HOST=0.0.0.0 \
29 BACKEND_ORIGIN=http://127.0.0.1:7656
30USER bun
31
32# Healthcheck lives in compose.yaml (podman's OCI image format ignores a
33# Containerfile HEALTHCHECK).
34CMD ["bun", "run", "server.ts"]