-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (63 loc) · 3.12 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (63 loc) · 3.12 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# basebid.lol — standalone Next.js app on Fly. Build context is this directory:
# fly deploy -c fly.toml --ha=false --remote-only --build-arg NEXT_PUBLIC_LAUNCH_FACTORY=0x... --build-arg NEXT_PUBLIC_LAUNCH_LOCKER=0x...
# Runtime: node server.js (Next standalone) + the in-process indexer loop;
# release_command (fly.toml) runs scripts/migrate.mjs from this same image.
FROM node:22-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
# NEXT_PUBLIC_* are INLINED INTO THE CLIENT BUNDLE AT BUILD TIME — they must be
# build args (fly.toml [build.args]), not only runtime secrets.
ARG NEXT_PUBLIC_CHAIN=base
ARG NEXT_PUBLIC_SITE_URL=https://basebid.lol
ARG NEXT_PUBLIC_LAUNCH_FACTORY
ARG NEXT_PUBLIC_LAUNCH_LOCKER
ARG NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD
ARG NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD
ARG NEXT_PUBLIC_LAUNCH_FACTORY_ARC
ARG NEXT_PUBLIC_LAUNCH_LOCKER_ARC
ENV NEXT_PUBLIC_CHAIN=$NEXT_PUBLIC_CHAIN \
NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL \
NEXT_PUBLIC_LAUNCH_FACTORY=$NEXT_PUBLIC_LAUNCH_FACTORY \
NEXT_PUBLIC_LAUNCH_LOCKER=$NEXT_PUBLIC_LAUNCH_LOCKER \
NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_FACTORY_ARC=$NEXT_PUBLIC_LAUNCH_FACTORY_ARC \
NEXT_PUBLIC_LAUNCH_LOCKER_ARC=$NEXT_PUBLIC_LAUNCH_LOCKER_ARC \
NEXT_TELEMETRY_DISABLED=1
RUN npm run build
FROM node:22-slim
WORKDIR /app
RUN groupadd -r app && useradd -r -g app -d /app app
ARG NEXT_PUBLIC_CHAIN=base
ARG NEXT_PUBLIC_SITE_URL=https://basebid.lol
ARG NEXT_PUBLIC_LAUNCH_FACTORY
ARG NEXT_PUBLIC_LAUNCH_LOCKER
ARG NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD
ARG NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD
ARG NEXT_PUBLIC_LAUNCH_FACTORY_ARC
ARG NEXT_PUBLIC_LAUNCH_LOCKER_ARC
# Server-side reads of the same vars must match the client build. Everything
# secret (DATABASE_URL, RPC, deploy block) comes from Fly secrets at runtime — see LAUNCH.md.
ENV NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0 \
NEXT_PUBLIC_CHAIN=$NEXT_PUBLIC_CHAIN \
NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL \
NEXT_PUBLIC_LAUNCH_FACTORY=$NEXT_PUBLIC_LAUNCH_FACTORY \
NEXT_PUBLIC_LAUNCH_LOCKER=$NEXT_PUBLIC_LAUNCH_LOCKER \
NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_FACTORY_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD=$NEXT_PUBLIC_LAUNCH_LOCKER_ROBINHOOD \
NEXT_PUBLIC_LAUNCH_FACTORY_ARC=$NEXT_PUBLIC_LAUNCH_FACTORY_ARC \
NEXT_PUBLIC_LAUNCH_LOCKER_ARC=$NEXT_PUBLIC_LAUNCH_LOCKER_ARC \
NEXT_TELEMETRY_DISABLED=1
COPY --from=build --chown=app:app /app/.next/standalone ./
COPY --from=build --chown=app:app /app/.next/static ./.next/static
COPY --from=build --chown=app:app /app/public ./public
COPY --from=build --chown=app:app /app/db ./db
COPY --from=build --chown=app:app /app/scripts/migrate.mjs ./scripts/migrate.mjs
COPY --from=build --chown=app:app /app/scripts/lib ./scripts/lib
USER app
EXPOSE 3000
CMD ["node", "server.js"]