-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd21f9b
commit ee6aaee
Showing
3 changed files
with
10 additions
and
35 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,44 +1,19 @@ | ||
|
||
FROM node:18.20.4-alpine as base | ||
|
||
ARG PORT=3000 | ||
|
||
EXPOSE ${PORT} | ||
FROM node:16-alpine AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY package*.json ./ | ||
RUN npm install --legacy-peer-deps | ||
|
||
FROM base as dependencies | ||
|
||
COPY package-lock.json /app/ | ||
|
||
RUN echo "Installing dependencies" \ | ||
apk --update --no-cache add --virtual build-dependencies make g++ && \ | ||
npm install --silent --production | ||
|
||
FROM dependencies as develop | ||
|
||
ENV NODE_ENV=development | ||
|
||
RUN npm install --silent | ||
|
||
COPY ./ /app | ||
|
||
COPY . . | ||
RUN npm run build | ||
|
||
FROM base as release | ||
FROM node:16-alpine | ||
|
||
ENV NODE_ENV=production | ||
|
||
COPY --from=dependencies /app/node_modules /app/node_modules | ||
COPY --from=develop /app/build /app/build | ||
|
||
RUN adduser -D -h /app -u 5000 user && \ | ||
chown -R user:user /app | ||
WORKDIR /app | ||
|
||
USER user | ||
COPY --from=build /app ./ | ||
|
||
ENTRYPOINT ["npm", "run"] | ||
EXPOSE 3000 | ||
|
||
CMD ["start"] | ||
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