Spaces:
Running
Running
burtenshaw
commited on
Commit
·
67e67c5
1
Parent(s):
07c4c18
use directly in command
Browse files- Dockerfile +2 -12
Dockerfile
CHANGED
@@ -15,26 +15,16 @@ RUN npm ci
|
|
15 |
# Build stage
|
16 |
FROM base AS builder
|
17 |
|
18 |
-
# Set HF_TOKEN as an environment variable for the build process
|
19 |
-
ENV HF_TOKEN=$(cat /run/secrets/HF_TOKEN)
|
20 |
-
|
21 |
# Copy dependencies from the 'deps' stage
|
22 |
COPY --from=deps /app/node_modules ./node_modules
|
23 |
# Copy the rest of the application code
|
24 |
COPY . .
|
25 |
-
# Build the SvelteKit application
|
26 |
-
RUN npm run build
|
27 |
|
28 |
# Production stage
|
29 |
FROM base AS production
|
30 |
ENV NODE_ENV=production
|
31 |
-
# Accept HF_TOKEN as a build argument for the production stage as well (optional, but good practice if needed at runtime)
|
32 |
-
ARG HF_TOKEN
|
33 |
-
# Set HF_TOKEN as an environment variable for runtime (if needed by the built app using $env/static/private)
|
34 |
-
# Although $env/static/private embeds the value at build time, setting it here doesn't hurt
|
35 |
-
# and might be needed if used dynamically elsewhere (though $env/dynamic/private is better for that)
|
36 |
-
ENV HF_TOKEN=${HF_TOKEN}
|
37 |
-
|
38 |
# Copy built application output from the 'builder' stage
|
39 |
# The output directory is typically 'build' when using adapter-node
|
40 |
COPY --from=builder /app/build ./build
|
|
|
15 |
# Build stage
|
16 |
FROM base AS builder
|
17 |
|
|
|
|
|
|
|
18 |
# Copy dependencies from the 'deps' stage
|
19 |
COPY --from=deps /app/node_modules ./node_modules
|
20 |
# Copy the rest of the application code
|
21 |
COPY . .
|
22 |
+
# Build the SvelteKit application, attempting to read the secret directly
|
23 |
+
RUN HF_TOKEN=$(cat /run/secrets/HF_TOKEN) npm run build
|
24 |
|
25 |
# Production stage
|
26 |
FROM base AS production
|
27 |
ENV NODE_ENV=production
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# Copy built application output from the 'builder' stage
|
29 |
# The output directory is typically 'build' when using adapter-node
|
30 |
COPY --from=builder /app/build ./build
|