Skip to content

Commit

Permalink
Merge pull request #104 from Alexigbokwe/4.2.1
Browse files Browse the repository at this point in the history
Optimise production build script, Update DockerFile
  • Loading branch information
Alexigbokwe authored May 22, 2024
2 parents 4a5e754 + df41cdf commit 637f81b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
35 changes: 24 additions & 11 deletions DockerFile
Original file line number Diff line number Diff line change
@@ -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"]
1 change: 0 additions & 1 deletion Resources/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"

[email protected].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==
[email protected].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"
Expand Down

0 comments on commit 637f81b

Please sign in to comment.