Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What happens when i try to build it in Dockerfile on Windows? #1987

Open
sunxiaolong321 opened this issue Feb 13, 2025 · 0 comments
Open

What happens when i try to build it in Dockerfile on Windows? #1987

sunxiaolong321 opened this issue Feb 13, 2025 · 0 comments

Comments

@sunxiaolong321
Copy link

the commend zenstack generate --schema zmodel/schema.zmodel is good when i run it on my windows machine, but was failed when build Dockerfile

this is the whole file of my Dockerfile

FROM node:18-alpine AS builder

WORKDIR /app

# 安装必要的系统依赖
RUN apk add --no-cache openssl openssl-dev

COPY package*.json ./
COPY pnpm-lock.yaml ./

RUN npm install -g pnpm
RUN pnpm install

COPY . .
RUN pnpm build
RUN pnpm prisma generate

FROM node:18-alpine

WORKDIR /app

# 安装运行时需要的系统依赖
RUN apk add --no-cache openssl

COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/zmodel ./zmodel
COPY --from=builder /app/server.json ./
COPY package*.json ./

EXPOSE 3000
CMD ["npm", "run", "start:prod"]

The package.json file is located.

{
  "name": "server",
  "version": "0.0.1",
  "description": "NestJS server with Prisma and Redis",
  "private": true,
  "scripts": {
    "db:push": "npx prisma db push --schema zmodel/prisma/schema.prisma",
    "generate": "zenstack generate --schema zmodel/schema.zmodel",
    "deploy:prod": "./scripts/deploy.sh production",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json",
    "prisma:generate": "prisma generate",
    "prisma:migrate": "prisma migrate dev",
    "prepare": "husky"
  },
  "dependencies": {
    "@nestjs/cache-manager": "^2.0.0",
    "@nestjs/common": "^10.0.0",
    "@nestjs/config": "^3.0.0",
    "@nestjs/core": "^10.0.0",
    "@nestjs/platform-express": "^10.0.0",
    "@nestjs/terminus": "^11.0.0",
    "@prisma/client": "^5.0.0",
    "@zenstackhq/openapi": "^2.11.6",
    "@zenstackhq/runtime": "^2.11.5",
    "@zenstackhq/server": "^2.11.5",
    "@zenstackhq/swr": "^2.11.5",
    "@zenstackhq/tanstack-query": "^2.11.5",
    "bcryptjs": "^2.4.3",
    "cache-manager": "^5.2.0",
    "cache-manager-redis-store": "^3.0.0",
    "cos-nodejs-sdk-v5": "^2.14.6",
    "joi": "^17.13.3",
    "jsonwebtoken": "^9.0.2",
    "nestjs-cls": "^5.0.1",
    "redis": "^4.6.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.8.0",
    "swagger-combine": "^1.4.0",
    "swagger-merger": "^1.5.4",
    "swagger-ui-express": "^5.0.1",
    "winston": "^3.17.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.20.0",
    "@nestjs/cli": "^10.0.0",
    "@nestjs/schematics": "^10.0.0",
    "@nestjs/swagger": "8.1.1",
    "@nestjs/testing": "^10.0.0",
    "@types/express": "^4.17.17",
    "@types/jest": "^29.5.14",
    "@types/node": "^20.17.17",
    "@types/supertest": "^2.0.12",
    "@typescript-eslint/eslint-plugin": "^8.24.0",
    "@typescript-eslint/parser": "^8.24.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.1",
    "eslint": "^9.20.1",
    "eslint-config-prettier": "^8.10.0",
    "eslint-plugin-prettier": "^4.2.1",
    "globals": "^15.14.0",
    "husky": "^9.1.7",
    "jest": "^29.5.0",
    "lint-staged": "^15.4.3",
    "prettier": "^2.8.8",
    "prisma": "^5.0.0",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "^29.1.0",
    "ts-loader": "^9.4.3",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "^4.2.0",
    "typescript": "^5.1.3",
    "typescript-eslint": "^8.24.0",
    "zenstack": "^2.11.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

and the part error msg is there
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant