build: update production artifacts and simplify dockerfiles to use pre-built output
This commit is contained in:
+5
-16
@@ -1,25 +1,14 @@
|
||||
# Nuxt website (SSR). Build context: repository root.
|
||||
# Nuxt website (SSR). Pre-built output.
|
||||
# docker build -f docker/web.Dockerfile -t imen-web .
|
||||
ARG NODE_IMAGE=docker.arvancloud.ir/node:24-alpine
|
||||
|
||||
FROM ${NODE_IMAGE} AS build
|
||||
ARG NPM_REGISTRY=https://registry.npmjs.org/
|
||||
ENV COREPACK_NPM_REGISTRY=${NPM_REGISTRY} npm_config_registry=${NPM_REGISTRY}
|
||||
RUN corepack enable
|
||||
WORKDIR /repo
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
COPY packages/shared packages/shared
|
||||
COPY apps/web apps/web
|
||||
RUN pnpm config set fetch-retries 5 \
|
||||
&& pnpm config set fetch-retry-maxtimeout 120000 \
|
||||
&& pnpm install --frozen-lockfile --filter "@imen/web..." || pnpm install --no-frozen-lockfile --filter "@imen/web..."
|
||||
RUN pnpm --filter "@imen/web..." build
|
||||
|
||||
# .output is self-contained (Nitro bundles the server dependencies it needs)
|
||||
FROM ${NODE_IMAGE}
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production PORT=3000
|
||||
COPY --from=build /repo/apps/web/.output ./.output
|
||||
|
||||
# Copy pre-built Nuxt Nitro bundle
|
||||
COPY apps/web/.output ./.output
|
||||
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
CMD ["node", ".output/server/index.mjs"]
|
||||
|
||||
Reference in New Issue
Block a user