-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile-fe
More file actions
43 lines (36 loc) · 1.35 KB
/
Dockerfile-fe
File metadata and controls
43 lines (36 loc) · 1.35 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
# A container with pnpm and python3 is required
FROM node:24.12.0-alpine AS pnpm_base
WORKDIR /app
RUN npm i --global --no-update-notifier --no-fund pnpm@10
RUN apk add --no-cache g++ make py3-pip libc6-compat
# run fetch in a separate step to avoid re-fetching deps on every change
FROM pnpm_base AS fetched_deps
WORKDIR /app
ENV NODE_ENV=production
COPY pnpm-lock.yaml ./
RUN pnpm config set store-dir /workdir/.pnpm-store
RUN pnpm fetch
# install all deps from cache
FROM fetched_deps AS with_all_deps
COPY . ./
RUN pnpm install --offline
# Build the FE
FROM with_all_deps AS builder
RUN pnpm --filter='*frontend' build
RUN pnpm --filter='*frontend' deploy pruned --prod
# Production image - only take pruned assets
FROM node:24.12.0-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 app
RUN adduser --system --uid 1001 app
USER app
COPY --chown=app:app --from=builder /app/apps/frontend/.next/standalone src/
COPY --chown=app:app --from=builder /app/apps/frontend/public src/apps/frontend/public
COPY --chown=app:app --from=builder /app/apps/frontend/.next/static src/apps/frontend/.next/static
COPY --chown=app:app --from=builder /app/apps/frontend/app.json app.json
# COPY --chown=app:app --from=builder /app/pruned/node_modules node_modules
EXPOSE 5000
ENV PORT 5000
CMD ["node", "src/apps/frontend/server.js"]
#CMD ["ls", "-la"]