cloudunity commited on
Commit
54de716
·
verified ·
1 Parent(s): ba90a93

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -15
Dockerfile CHANGED
@@ -18,20 +18,26 @@ FROM node:24-bookworm-slim AS webapp
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
@@ -43,7 +49,7 @@ RUN test -d src/lexicons && echo "[build] lexicons OK" \
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).
45
  # On HF Spaces, set a Space variable PDS_HOSTNAME and rebuild so this matches.
46
- ARG PDS_HOSTNAME=hf.space
47
  ENV EXPO_PUBLIC_DEFAULT_SERVICE=https://${PDS_HOSTNAME}
48
  ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=rochester-pds
49
  ENV NODE_ENV=production
@@ -304,10 +310,7 @@ ENV PDS_EMAIL_FROM_ADDRESS=
304
  # Skip email confirmation flow entirely (no SMTP on HF)
305
  ENV PDS_EMAIL_DISABLE_CONFIRMATION_LINK=true
306
 
307
- # Public hostname. Set this to your Space's public URL (as a Space secret or
308
- # variable named PDS_HOSTNAME) so the PDS advertises the right endpoint:
309
- # https://<owner>-<space>.hf.space
310
- # Users' handles will be <name>.<that hostname>.
311
  ENV PDS_HOSTNAME=cloudunity-gemma-api1.hf.space
312
 
313
  EXPOSE 7860
 
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
+ RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
22
+
23
  WORKDIR /build
24
 
25
+ # The Space's build context may contain only this Dockerfile (HF uploads can
26
+ # exclude the repo), so clone the source from GitHub instead of COPY . .
27
+ # Pin to a commit SHA for reproducible builds. When you push new commits and
28
+ # want them live, update SOURCE_REF (or override it as a Space build arg).
29
+ ARG SOURCE_REPO=https://github.com/CloudCompile/social-app.git
30
+ ARG SOURCE_REF=a89f05821ad42b3b88ccba1290d8ce7632b5a42a
31
+ # Fetch by SHA (clone --branch only accepts refs). GitHub allows fetching
32
+ # reachable commit SHAs directly.
33
+ RUN git init . \
34
+ && git remote add origin ${SOURCE_REPO} \
35
+ && git fetch --depth 1 origin ${SOURCE_REF} \
36
+ && git checkout FETCH_HEAD
37
 
38
  # Install deps. package.json's postinstall runs lexicons:generate and
39
+ # intl:compile, which the webpack build needs.
40
+ RUN pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile
 
 
 
 
 
 
41
 
42
  # postinstall generated lexicons + i18n catalogs; verify they exist (the
43
  # intl:compile-if-needed guard is skipped outside CI, so compile explicitly
 
49
  # Build the static web app with this PDS baked in as the default service,
50
  # so sign-in/sign-up default to this server (users can still pick another).
51
  # On HF Spaces, set a Space variable PDS_HOSTNAME and rebuild so this matches.
52
+ ARG PDS_HOSTNAME=cloudunity-gemma-api1.hf.space
53
  ENV EXPO_PUBLIC_DEFAULT_SERVICE=https://${PDS_HOSTNAME}
54
  ENV EXPO_PUBLIC_BUNDLE_IDENTIFIER=rochester-pds
55
  ENV NODE_ENV=production
 
310
  # Skip email confirmation flow entirely (no SMTP on HF)
311
  ENV PDS_EMAIL_DISABLE_CONFIRMATION_LINK=true
312
 
313
+ # Public hostname. Users' handles will be <name>.<that hostname>.
 
 
 
314
  ENV PDS_HOSTNAME=cloudunity-gemma-api1.hf.space
315
 
316
  EXPOSE 7860