File size: 1,224 Bytes
96b39f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM node:22-slim

RUN apt-get update \
    && apt-get install -y --no-install-recommends git ca-certificates python3 make g++ \
    && rm -rf /var/lib/apt/lists/* \
    && npm install -g pnpm@9

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
WORKDIR /home/user/app

# Pin to the commit this deployment was tested against (github.com/cloudflare/cloudflare-os).
RUN git clone https://github.com/cloudflare/cloudflare-os.git . \
    && git checkout e1ab8fbd4f609aff7ede9d490bafe1bcf9b2a682

RUN pnpm install --frozen-lockfile

# Build exactly what run-local builds to serve the app: the typed-storage dist
# (imported by the backend) and the static frontend bundle.
RUN pnpm --filter @gadgets/typed-storage build \
    && pnpm --filter @gadgets/workshop-frontend exec vite build

# wrangler dev binds to localhost by default; inside the container it must
# listen on 0.0.0.0 for the Space proxy to reach it. run-dev-server.js doesn't
# expose an --ip passthrough, so append the flag where it builds wrangler args.
RUN sed -i '/^const args = configs.flatMap/a args.push("--ip", "0.0.0.0");' run-dev-server.js

ENV WRANGLER_SEND_METRICS=false
EXPOSE 8787

CMD ["node", "run-dev-server.js", "--serve-frontend-assets"]