feat: update dockerfile to work with nuxt

This commit is contained in:
mrjvs 2025-04-09 13:42:39 +02:00
parent 0b8735fa47
commit f44bcd3ad0
3 changed files with 14 additions and 7 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.git/
node_modules/
.env
.nuxt
.output

View File

@ -4,7 +4,7 @@ ARG app_dir="/home/node/app"
# * Base Node.js image
FROM node:20-alpine AS base
FROM node:22-alpine AS base
ARG app_dir
WORKDIR ${app_dir}
@ -35,14 +35,15 @@ RUN npm run build
FROM base AS final
ARG app_dir
RUN mkdir -p ${app_dir}/logs && chown node:node ${app_dir}/logs
ENV NODE_ENV=production
USER node
ENV NODE_ENV=production
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=8080
EXPOSE 8080
COPY package.json .
COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
COPY --from=build ${app_dir} ${app_dir}
COPY --from=build ${app_dir}/.output ${app_dir}/.output
CMD ["node", "."]
CMD ["node", "--enable-source-maps", ".output/server/index.mjs"]

View File

@ -5,8 +5,9 @@
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
"start": "node --enable-source-maps .",
"start": "node --enable-source-maps .output/server/index.mjs",
"build": "nuxt build",
"prepare": "nuxt prepare",
"dev": "nuxt dev",
"lint": "eslint .",
"lint:fix": "eslint . --fix"