Files
nademitex_user/Dockerfile
T

40 lines
1.1 KiB
Docker
Raw Normal View History

FROM node:20
WORKDIR /app
COPY package.json package-lock.json .npmrc ./
COPY scripts ./scripts
ENV NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
RUN npm config set registry https://registry.npmmirror.com \
&& npm config set replace-registry-host always \
&& npm config set fetch-retry-mintimeout 10000 \
&& npm config set fetch-retry-maxtimeout 120000 \
&& npm config set fetch-timeout 120000 \
&& npm config set fetch-retries 5
ENV NODE_ENV=development
RUN npm ci --include=dev --foreground-scripts --no-audit --no-fund --legacy-peer-deps --registry=https://registry.npmmirror.com
COPY . .
# نام‌ها باید با Environment و Build-time Arguments در Dokploy یکی باشند
ARG VITE_API_BASE_URL
ARG VITE_BASE_PATH
RUN node scripts/write-docker-vite-env.mjs \
&& unset VITE_API_BASE_URL VITE_BASE_PATH \
&& npm run build-only
ENV NODE_ENV=production
ENV VITE_BASE_PATH=/
ENV PORT=7676
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 7676
ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "scripts/serve-user.mjs"]