Skip to content

Commit 6b159e5

Browse files
committed
Complete revamp, now running node 22
1 parent c3b0b7d commit 6b159e5

18 files changed

+1210
-796
lines changed

.dockerignore

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
chart/*
2-
dist/*
1+
dist
32
.editorconfig
43
.env
54
*.env
6-
.git/*
7-
.github/*
5+
.git
6+
.github
87
.gitignore
98
*.md
10-
node_modules/*
11-
nodemon.json
12-
now.json
9+
node_modules
1310
*.sh
14-
tmp/*
11+
tmp
12+
*.tmp

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ indent_style = space
1212
[*.yaml]
1313
indent_size = 2
1414

15+
[*.json]
16+
indent_size = 2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.cache
33
*.class
44
crash.log
5+
dist
56
.env
67
.idea/
78
.jekyll-metadata

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@jsr:registry=https://npm.jsr.io

Dockerfile

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
FROM node:15 as base
2-
RUN groupadd -r appuser && \
3-
useradd --create-home --gid appuser --home-dir /app --no-log-init --system appuser
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM node:22-bookworm AS base
43

5-
FROM base AS build
64
WORKDIR /app
7-
USER appuser
8-
COPY --chown=appuser:appuser . .
9-
RUN yarn install && \
10-
yarn run build
115

12-
FROM base AS run
6+
USER root
7+
8+
RUN apt-get update && \
9+
apt-get install -y dumb-init
10+
11+
COPY package.json package-lock.json /app/
12+
RUN npm install --audit=false --fund=false --omit dev
13+
14+
15+
#
16+
# build the app
17+
#
18+
FROM base AS builder
19+
20+
COPY . /app/
21+
22+
RUN npm install --audit=false --fund=false
23+
RUN npm run build
24+
25+
#
26+
# runner
27+
#
28+
FROM gcr.io/distroless/nodejs22-debian12:latest AS runner
29+
1330
ARG COMMIT="(not set)"
1431
ARG LASTMOD="(not set)"
1532
ENV COMMIT=$COMMIT
1633
ENV LASTMOD=$LASTMOD
17-
WORKDIR /app
18-
USER appuser
19-
COPY --chown=appuser:appuser . .
20-
#COPY --chown=appuser:appuser --from=build /app/dist /app/dist
21-
RUN yarn install --production
22-
EXPOSE 4000
23-
ENV PORT 4000
24-
CMD ["yarn", "run", "start"]
34+
ENV NODE_ENV=production
2535

36+
USER nonroot
37+
COPY --chown=nonroot:nonroot --from=base /usr/bin/dumb-init /usr/bin/dumb-init
38+
COPY --chown=nonroot:nonroot --from=base /app/node_modules /app/node_modules
39+
COPY --chown=nonroot:nonroot --from=builder /app/dist /app/dist
40+
COPY --chown=nonroot:nonroot --exclude=src . /app
41+
42+
WORKDIR /app
43+
ENV PORT 5000
44+
ENV HOSTNAME 0.0.0.0
45+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
46+
CMD ["/nodejs/bin/node", "dist/server.js"]

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ to attach them to the start of each source file to most effectively
629629
state the exclusion of warranty; and each file should have at least
630630
the "copyright" line and a pointer to where the full notice is found.
631631

632-
<one line to give the program's name and a brief idea of what it does.>
633-
Copyright (C) <year> <name of author>
632+
regexplanet-nodejs: Testing regular expressions in NodeJS
633+
Copyright (C) 2024 Andrew Marcuse
634634

635635
This program is free software: you can redistribute it and/or modify
636636
it under the terms of the GNU Affero General Public License as published by

0 commit comments

Comments
 (0)