Explorar el Código

Merge branch 'main' of http://gogs.clouditive.ir/mohamad-salimi/talentyar-admin

Mohammad Mahdi Salimi hace 1 mes
padre
commit
d2e3812a8b
Se han modificado 4 ficheros con 66 adiciones y 1 borrados
  1. 2 0
      .npmrc
  2. 47 0
      Dockerfile
  3. 16 0
      docker-compose.yml
  4. 1 1
      package.json

+ 2 - 0
.npmrc

@@ -0,0 +1,2 @@
+registry=https://mirror2.chabokan.net/npm/
+#registry=https://mirror-npm.runflare.com/

+ 47 - 0
Dockerfile

@@ -0,0 +1,47 @@
+# ---------- base ----------
+FROM node:20-alpine AS base
+
+WORKDIR /app
+
+RUN npm config set registry https://mirror2.chabokan.net/npm/
+RUN npm install -g pnpm
+RUN pnpm config set registry https://mirror2.chabokan.net/npm/
+
+# ---------- deps ----------
+FROM base AS deps
+
+COPY package.json pnpm-lock.yaml* ./
+
+RUN pnpm install --no-frozen-lockfile
+
+# ---------- builder ----------
+FROM base AS builder
+
+ARG VITE_API_BASE_URL
+ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
+
+COPY --from=deps /app/node_modules ./node_modules
+COPY . .
+
+RUN pnpm build
+
+# ---------- runner ----------
+FROM node:20-alpine AS runner
+
+WORKDIR /app
+
+ENV NODE_ENV=production
+
+# install serve LOCAL (not global)
+RUN npm config set registry https://mirror2.chabokan.net/npm/
+RUN npm install -g serve
+
+COPY --from=builder /app/dist ./dist
+
+RUN addgroup -S nodejs && adduser -S reactjs -G nodejs
+
+USER reactjs
+
+EXPOSE 3001
+
+CMD ["serve", "-s", "dist", "-l", "3001"]

+ 16 - 0
docker-compose.yml

@@ -0,0 +1,16 @@
+version: '3.9'
+
+services:
+  talentyar-admin:
+    build:
+      context: .
+      dockerfile: Dockerfile
+      args:
+        VITE_API_BASE_URL: ${VITE_API_BASE_URL}
+
+    container_name: talentyar-admin
+
+    restart: unless-stopped
+
+    ports:
+      - '3001:3001'

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "shadcn-admin",
+  "name": "talentyar-admin",
   "private": false,
   "version": "2.2.1",
   "type": "module",