-
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.
* build:webpack * tsconfig.json serverless * Dockerfile
- Loading branch information
Showing
5 changed files
with
123 additions
and
3 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,60 @@ | ||
# Docker | ||
Dockerfile | ||
.dockerignore | ||
|
||
# Compiled output | ||
/dist | ||
node_modules | ||
error-graph.json | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
**/.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
/test | ||
**/*.spec.ts | ||
**/*.test.ts | ||
**/*.spec.tsx | ||
**/*.test.tsx | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# Local settings | ||
.env*.local | ||
.env.test | ||
.eslintrc.js | ||
.prettierrc | ||
|
||
|
||
# Git | ||
.github | ||
.gitignore | ||
.git | ||
|
||
# Other | ||
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,50 @@ | ||
## Development stage | ||
FROM amd64/node:18.18-alpine As development | ||
|
||
RUN mkdir -p /usr/src/app/node_modules && chown -R node:node /usr/src/app | ||
WORKDIR /usr/src/app | ||
# Copy application dependency manifests to the container image. | ||
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | ||
# Copying this first prevents re-running npm install on every code change. | ||
COPY --chown=node:node package*.json ./ | ||
|
||
USER node | ||
|
||
RUN npm ci | ||
|
||
COPY --chown=node:node . . | ||
|
||
## Build stage | ||
FROM amd64/node:18.18-alpine As build | ||
|
||
RUN mkdir -p /usr/src/app/node_modules && chown -R node:node /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
COPY --chown=node:node package*.json ./ | ||
|
||
# In order to run `npm run build` we need access to the Nest CLI which is a dev dependency. In the previous development stage we ran `npm ci` which installed all dependencies, so we can copy over the node_modules directory from the development image | ||
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules | ||
|
||
COPY --chown=node:node . . | ||
|
||
USER node | ||
|
||
RUN npm run build:webpack | ||
|
||
RUN npm ci --omit=dev && npm cache clean --force | ||
|
||
|
||
## Production stage | ||
FROM amd64/node:18.18-alpine As production | ||
|
||
RUN mkdir -p /usr/src/app/node_modules && chown -R node:node /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
# Copy the bundled code from the build stage to the production image | ||
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules | ||
COPY --chown=node:node --from=build /usr/src/app/dist ./dist | ||
COPY --chown=node:node --from=build /usr/src/app/.env ./ | ||
|
||
USER node | ||
|
||
CMD ["node", "dist/main.js"] |
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