-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement multi-stage build in Dockerfile
- Loading branch information
1 parent
0356adc
commit 47de3c4
Showing
1 changed file
with
20 additions
and
6 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,18 +1,32 @@ | ||
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal | ||
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal AS build | ||
|
||
ENV TZ="Europe/Helsinki" | ||
|
||
WORKDIR /opt/app-root/src | ||
|
||
# Setup | ||
COPY package* ./ | ||
COPY package*.json ./ | ||
COPY tsconfig.json ./ | ||
RUN npm ci -f --omit-dev --ignore-scripts | ||
|
||
RUN npm ci | ||
|
||
COPY src ./src | ||
|
||
# Build | ||
RUN npm run build | ||
|
||
|
||
FROM registry.access.redhat.com/ubi9/nodejs-18-minimal | ||
|
||
ENV TZ="Europe/Helsinki" | ||
|
||
ENV NODE_ENV=production | ||
|
||
WORKDIR /opt/app-root/src | ||
|
||
COPY --from=build /opt/app-root/src/package*.json ./ | ||
COPY --from=build /opt/app-root/src/build ./build | ||
|
||
RUN npm ci | ||
|
||
EXPOSE 3003 | ||
|
||
CMD ["npm", "run", "start:prod"] | ||
CMD ["node", "build/index.js"] |