updated dependency, standalone seems to work

updated pnpm version
added dockerignore
revert the standalone output
This commit is contained in:
Suyono 2024-02-23 11:26:46 +11:00
parent 5c8a3f56dd
commit bea1c3aba3
6 changed files with 1051 additions and 529 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
**/node_modules
.git
.gitignore
.local
.env*

View File

@ -1,2 +1,2 @@
nodejs 20.8.1
pnpm 8.9.2
pnpm 8.15.3

View File

@ -1,8 +1,37 @@
FROM node:lts-alpine as builder
FROM node:lts-alpine as base
FROM base as builder
USER 1000:1000
ADD --chown=1000:1000 . /home/node/nextts
WORKDIR /home/node/nextts
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="/home/node/.shrc" SHELL="$(which sh)" sh -
ENV PATH=/home/node/.local/share/pnpm:$PATH
RUN pnpm install && pnpm run build
FROM base as runtime
RUN npm install -g pm2
COPY --from=builder /home/node/nextts/public /home/node/nextts/public
COPY --from=builder /home/node/nextts/.next/standalone /home/node/nextts
COPY --from=builder /home/node/nextts/.next/static /home/node/nextts/.next/static
ADD --chown=1000:1000 pm2.config.js /home/node/nextts/
ADD --chown=1000:1000 dummies /home/node/nextts/dummies
RUN chown -R 1000:1000 /home/node/nextts
USER 1000:1000
WORKDIR /home/node/nextts
ENV PORT 3000
ENV NODE_ENV production
ENV HOME /home/node
ENV HOSTNAME "0.0.0.0"
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="/home/node/.shrc" SHELL="$(which sh)" sh -
ENV PATH=/home/node/.local/share/pnpm:$PATH
RUN pnpm install
CMD ["pm2-runtime", "pm2.config.js"]
#CMD ["node", "server.js"]

View File

@ -9,24 +9,25 @@
"lint": "next lint"
},
"dependencies": {
"@types/dompurify": "^3.0.3",
"@types/jsdom": "^21.1.3",
"@types/dompurify": "^3.0.5",
"@types/jsdom": "^21.1.6",
"@types/node": "20.6.5",
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"autoprefixer": "10.4.16",
"bright": "^0.8.4",
"dompurify": "^3.0.6",
"dompurify": "^3.0.9",
"eslint": "8.50.0",
"eslint-config-next": "13.5.2",
"html-react-parser": "^4.2.2",
"html-react-parser": "^4.2.10",
"jsdom": "^22.1.0",
"mysql2": "^3.6.1",
"mysql2": "^3.9.1",
"next": "13.5.2",
"postcss": "8.4.30",
"react": "18.2.0",
"react-dom": "18.2.0",
"redis": "^4.6.10",
"redis": "^4.6.13",
"sharp": "^0.33.2",
"tailwindcss": "3.3.3",
"typescript": "5.2.2"
},

7
pm2.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
apps: [{
script: "server.js",
instances: 4,
exec_mode: "cluster"
}]
}

File diff suppressed because it is too large Load Diff