diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b494d6d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM node:22-alpine AS builder + +WORKDIR /app + +RUN npm install -g pnpm + +COPY pnpm-lock.yaml ./ +COPY package.json ./ + +RUN pnpm install --frozen-lockfile + +COPY . . + +RUN pnpm build + +FROM node:22-alpine AS runner + +WORKDIR /app + +ENV NODE_ENV=production + +RUN npm install -g pnpm + +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/next.config.js ./next.config.js +COPY --from=builder /app/app ./app + +EXPOSE 3000 + +CMD ["pnpm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7f34faf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.8' + +services: + nextjs: + build: + context: . + dockerfile: Dockerfile + container_name: nextjs-app + environment: + - NEXT_PUBLIC_VERSION=${NEXT_PUBLIC_VERSION} + - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} + - NEXT_PUBLIC_SERVER_SOCKET_URL=${NEXT_PUBLIC_SERVER_SOCKET_URL} + ports: + - "3000:3000" + env_file: + - .env.local + restart: unless-stopped \ No newline at end of file diff --git a/example.env.local b/example.env.local index 7a4dbd6..ab2e819 100644 --- a/example.env.local +++ b/example.env.local @@ -1,4 +1,4 @@ -NEXT_PUBLIC_VERSION = "2.0.0" +NEXT_PUBLIC_VERSION = "2.1.0" NEXT_PUBLIC_API_URL = "https://crm.witel.ir/server" NEXT_PUBLIC_SERVER_SOCKET_URL = "wss://crm.witel.ir"