diff --git a/DockerFile b/DockerFile index c6c59aa..99d2f23 100644 --- a/DockerFile +++ b/DockerFile @@ -1,19 +1,32 @@ -FROM node:14-alpine - -RUN mkdir -p /app/expressweb-version4 - -WORKDIR /app/expressweb-version4 - -COPY package.json . +FROM node:21-alpine3.18 as base +# Stage 1: All dependencies +FROM base as deps +WORKDIR /app +ADD package.json ./ RUN npm install +# Stage 2: Production dependencies +FROM base as production-deps +WORKDIR /app +ADD package.json ./ RUN npm install ts-node +RUN npm install --omit=dev -COPY . . - +# Stage 3: Project Build +FROM base as build +WORKDIR /app +COPY --from=deps /app/node_modules /app/node_modules +ADD . . RUN npm run build -EXPOSE 5200 - +# Stage 4: Production stage +FROM base +ENV NODE_ENV=production +WORKDIR /app +COPY --from=production-deps /app/node_modules /app/node_modules +COPY --from=production-deps /app/package.json /app/package.json +COPY --from=build /app/build /app +COPY --from=build /app/.env /app/.env +EXPOSE 8080 CMD ["npm","start"] \ No newline at end of file diff --git a/Resources/Command.ts b/Resources/Command.ts index 728c1d6..8d706dc 100644 --- a/Resources/Command.ts +++ b/Resources/Command.ts @@ -36,7 +36,6 @@ const commands = [ "ExpressWebJs/commands/run-dev", "ExpressWebJs/commands/run-build", "ExpressWebJs/commands/run-start", - "ExpressWebJs/commands/run-prod", "ExpressWebJs/commands/make-domain", "ExpressWebJs/commands/domain:make-controller", "ExpressWebJs/commands/domain:make-model", diff --git a/package.json b/package.json index e7c94fc..8f39da9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "maker": "ts-node maker", "test": "jest", "dev": "ts-node maker run-dev", - "start": "node ./build/maker run-start", + "start": "ts-node maker run-start", "build": "ts-node maker run-build" }, "keywords": [ @@ -36,7 +36,7 @@ "expresswebcorets": "2.1.41", "expresswebjs-preset-ts": "1.0.5", "log4js": "^6.3.0", - "maker-console-ts": "2.1.15", + "maker-console-ts": "2.1.16", "module-alias": "^2.2.2", "recursive-copy": "^2.0.13", "set-value": "^4.1.0" diff --git a/yarn.lock b/yarn.lock index 830ec46..efffefb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2144,10 +2144,10 @@ make-fetch-happen@^13.0.0, make-fetch-happen@^13.0.1: promise-retry "^2.0.1" ssri "^10.0.0" -maker-console-ts@2.1.15: - version "2.1.15" - resolved "https://registry.yarnpkg.com/maker-console-ts/-/maker-console-ts-2.1.15.tgz#38f90b98d47190cf2b0f9a1fcde5054bb400b0e4" - integrity sha512-ND9RaHGf0fxRYvd8SpzWcAXQdbWLYeF6mMxYYrVy10kEeR1K+vsT/rpE7kw1gyABTZijITvP75VfmsYv5XePug== +maker-console-ts@2.1.16: + version "2.1.16" + resolved "https://registry.yarnpkg.com/maker-console-ts/-/maker-console-ts-2.1.16.tgz#cf55b679570beb63024f371e0a246d2387ed6eae" + integrity sha512-ABc6JjsSlea5B9XRYZTqL9RcpHQxzRhsKt7CB8EZbPaRBZsGjuJD/niPavj1Fm2TMsoqLoZAFutJCABOGc/EOQ== dependencies: commander "^11.1.0" dotenv "^8.2.0"