-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from Alexigbokwe/4.2.1
Optimise production build script, Update DockerFile
- Loading branch information
Showing
4 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|