Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +23 -9
Dockerfile
CHANGED
|
@@ -11,20 +11,34 @@
|
|
| 11 |
# =============================================================================
|
| 12 |
|
| 13 |
# ---------------------------------------------------------------- build stage
|
| 14 |
-
FROM node:
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
WORKDIR /build
|
| 18 |
|
| 19 |
# Copy the whole repo (needed by the Expo/webpack build)
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# Build the static web app with this PDS baked in as the default service,
|
| 30 |
# so sign-in/sign-up default to this server (users can still pick another).
|
|
@@ -33,7 +47,7 @@ ARG PDS_HOSTNAME=hf.space
|
|
| 33 |
ENV EXPO_PUBLIC_DEFAULT_SERVICE=https://${PDS_HOSTNAME}
|
| 34 |
ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=rochester-pds
|
| 35 |
ENV NODE_ENV=production
|
| 36 |
-
RUN pnpm build-web || (npx expo export:web && node ./scripts/post-web-build.js)
|
| 37 |
|
| 38 |
# post-web-build copies assets into bskyweb/static; for static hosting we serve
|
| 39 |
# web-build directly, so just make sure it exists
|
|
|
|
| 11 |
# =============================================================================
|
| 12 |
|
| 13 |
# ---------------------------------------------------------------- build stage
|
| 14 |
+
FROM node:24-bookworm-slim AS webapp
|
| 15 |
|
| 16 |
+
# Pin pnpm explicitly: package.json's packageManager field is not the classic
|
| 17 |
+
# "pnpm@x.y.z" string, so corepack would otherwise pick the latest pnpm,
|
| 18 |
+
# which cannot read this repo's lockfile. 11.21.0 is the version declared in
|
| 19 |
+
# devEngines and verified against pnpm-lock.yaml.
|
| 20 |
+
RUN corepack enable && corepack prepare pnpm@11.21.0 --activate
|
| 21 |
WORKDIR /build
|
| 22 |
|
| 23 |
# Copy the whole repo (needed by the Expo/webpack build)
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
+
# Install deps. package.json's postinstall runs lexicons:generate and
|
| 27 |
+
# intl:compile, which the webpack build needs. If the build context lost the
|
| 28 |
+
# lockfile (some Space uploads exclude it), fall back to a plain install.
|
| 29 |
+
RUN if [ -f pnpm-lock.yaml ]; then \
|
| 30 |
+
pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile; \
|
| 31 |
+
else \
|
| 32 |
+
echo "[build] pnpm-lock.yaml missing from build context - regenerating" && \
|
| 33 |
+
pnpm install --no-frozen-lockfile; \
|
| 34 |
+
fi
|
| 35 |
+
|
| 36 |
+
# postinstall generated lexicons + i18n catalogs; verify they exist (the
|
| 37 |
+
# intl:compile-if-needed guard is skipped outside CI, so compile explicitly
|
| 38 |
+
# if the catalog is missing)
|
| 39 |
+
RUN test -d src/lexicons && echo "[build] lexicons OK" \
|
| 40 |
+
&& (test -f src/locale/locales/en/messages.ts || pnpm intl:compile) \
|
| 41 |
+
&& echo "[build] i18n OK"
|
| 42 |
|
| 43 |
# Build the static web app with this PDS baked in as the default service,
|
| 44 |
# so sign-in/sign-up default to this server (users can still pick another).
|
|
|
|
| 47 |
ENV EXPO_PUBLIC_DEFAULT_SERVICE=https://${PDS_HOSTNAME}
|
| 48 |
ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=rochester-pds
|
| 49 |
ENV NODE_ENV=production
|
| 50 |
+
RUN pnpm run build-web || (npx expo export:web && node ./scripts/post-web-build.js)
|
| 51 |
|
| 52 |
# post-web-build copies assets into bskyweb/static; for static hosting we serve
|
| 53 |
# web-build directly, so just make sure it exists
|