Compare commits

...

2 Commits

Author SHA1 Message Date
Jack Hsu 2a575dbe9a feat(node): use multi-stage builds for better docker layer caching 2025-06-11 12:16:12 -04:00
Jack Hsu 3702ba7cd7 feat(node): update app generator 2025-06-10 17:33:58 -04:00
4 changed files with 14 additions and 9 deletions
+3
View File
@@ -102,3 +102,6 @@ node_modules/
# Task files
tasks.json
tasks/
# Raw docs configuration
.rawdocsrc
+2 -1
View File
@@ -1 +1,2 @@
pnpm nx prepush --parallel 8 --tuiAutoExit 0
#pnpm nx prepush --parallel 8 --tuiAutoExit 0
node "../raw-docs/scripts/check-docs.mjs" || true
@@ -33,6 +33,7 @@ import {
NormalizedSchema,
} from './lib';
// bump
function updateTsConfigOptions(tree: Tree, options: NormalizedSchema) {
if (options.isUsingTsSolutionConfig) {
return;
@@ -1,10 +1,5 @@
# This file is generated by Nx.
#
# Build the docker image with `npx nx docker-build <%= project %>`.
# Tip: Modify "docker-build" options in project.json to change docker build args.
#
# Run the container with `docker run -p 3000:3000 -t <%= sanitizedProjectName %>`.
FROM docker.io/node:lts-alpine
# Stage 1: Build
FROM docker.io/node:lts-alpine AS build
ENV HOST=0.0.0.0
ENV PORT=3000
@@ -12,7 +7,7 @@ ENV PORT=3000
WORKDIR /app
RUN addgroup --system <%= sanitizedProjectName %> && \
adduser --system -G <%= sanitizedProjectName %> <%= sanitizedProjectName %>
adduser --system -G <%= sanitizedProjectName %> <%= sanitizedProjectName %> \
COPY <%= buildLocation %> <%= sanitizedProjectName %>/
COPY <%= projectPath %>/package.json <%= sanitizedProjectName %>/
@@ -22,4 +17,9 @@ RUN chown -R <%= sanitizedProjectName %>:<%= sanitizedProjectName %> .
# The bundled output will include external dependencies.
RUN npm --prefix <%= sanitizedProjectName %> --omit=dev -f install
# Stage 2: Production
FROM docker.io/node:lts-apline
WORKDIR /app
COPY --from=build /app/<%= sanitizedProjectName %> <%= sanitizedProjectName %>/
CMD [ "node", "<%= sanitizedProjectName %>" ]