Files
tehran_tala/apps/admin-panel/Dockerfile
T

41 lines
1.2 KiB
Docker
Raw Normal View History

2026-09-10 00:18:53 +03:30
FROM node:20-bookworm AS base
2026-09-09 19:39:13 +03:30
2026-09-10 00:25:43 +03:30
# Server often cannot reach registry.npmjs.org (Cloudflare). Override in Dokploy if needed.
ARG NPM_REGISTRY=https://mirror.kargadan.ir/repository/npm-group/
ENV npm_config_registry=${NPM_REGISTRY}
2026-09-09 19:39:13 +03:30
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
2026-09-10 00:25:43 +03:30
# Skip corepack (it fetches pnpm from npmjs/Cloudflare). Install from mirror instead.
2026-09-10 00:48:06 +03:30
# Pin major only — Iranian mirrors often lag behind exact patch versions (e.g. 2.10.12).
RUN npm install -g pnpm@9 turbo@2 \
2026-09-10 00:25:43 +03:30
&& printf 'registry=%s\n' "${NPM_REGISTRY}" > /root/.npmrc
2026-09-09 19:39:13 +03:30
2026-09-10 00:13:03 +03:30
FROM base AS builder
2026-09-09 19:39:13 +03:30
WORKDIR /app
COPY . .
RUN turbo prune admin-panel --docker
2026-09-10 00:13:03 +03:30
FROM base AS installer
2026-09-09 19:39:13 +03:30
WORKDIR /app
# First install dependencies
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
2026-09-10 00:25:43 +03:30
RUN pnpm install --frozen-lockfile
2026-09-09 19:39:13 +03:30
# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN pnpm turbo run build --filter=admin-panel...
FROM nginx:alpine AS runner
# Copy custom Nginx configuration
COPY nginx-spa.conf /etc/nginx/conf.d/default.conf
# Copy the built files from the installer stage
COPY --from=installer /app/apps/admin-panel/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]