forked from boale/rs-cart-api
-
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.
- Loading branch information
1 parent
2f55f7e
commit b888a75
Showing
2 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Top folder by size | ||
node_modules/ | ||
# We don't need dist from the host, because we build it in docker. | ||
dist | ||
# We don't need test folder for production either | ||
test | ||
|
||
# Other | ||
.dockerignore | ||
.elasticbeanstalk/* | ||
.eslintrc.js | ||
.git | ||
.gitignore | ||
.prettierrc | ||
Dockerfile* | ||
README.md | ||
|
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# build essential node_modules | ||
FROM node:lts-alpine AS production-modules | ||
WORKDIR /app | ||
COPY ./package*.json ./ | ||
RUN npm install --only=production && npm prune --production | ||
|
||
# make build | ||
FROM node:lts-alpine AS build | ||
WORKDIR /app | ||
# Copy package*.json files, install dependencies | ||
COPY ./package*.json ./ | ||
COPY . . | ||
# build application | ||
RUN npm install && npm run build | ||
|
||
# Release with Alpine | ||
FROM node:lts-alpine AS release | ||
WORKDIR /app | ||
# Install app and dependencies | ||
COPY --from=build /app/package.json ./ | ||
COPY --from=build /app/dist ./dist | ||
COPY --from=production-modules /app/node_modules ./node_modules | ||
USER node | ||
EXPOSE 4000 | ||
ENTRYPOINT ["node", "dist/main.js"] |