-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
51 lines (38 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# syntax=docker/dockerfile:1.7
FROM oven/bun:1 AS base
WORKDIR /app
# ---- deps (maksimum cache) ----
FROM base AS deps
COPY package.json bun.lock ./
RUN bun install
# ---- build (bundle + minify) ----
FROM base AS build
COPY --from=deps /app/node_modules node_modules
COPY . .
# Run tests (allow failure to ensure build completes)
RUN bun run test || true
ENV NODE_ENV=production
RUN bun build src/server.ts \
--outfile server.js \
--target bun \
--minify \
--sourcemap=none
# ---- runtime (full image needed for cast/curl) ----
FROM oven/bun:1 AS runtime
WORKDIR /app
# Install dependencies for foundry/cast
RUN apt-get update && apt-get install -y curl git bash
# Install Foundry (cast)
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
RUN foundryup
# Move binaries to global path so 'bun' user can access them
RUN cp /root/.foundry/bin/cast /usr/local/bin/cast && \
chmod +x /usr/local/bin/cast
ENV NODE_ENV=production
COPY --from=build /app/server.js .
COPY --from=deps /app/node_modules node_modules
COPY package.json .
USER bun
EXPOSE 4000/tcp
CMD ["bun", "server.js"]