diff --git a/Dockerfile b/Dockerfile index c5413ae..32b2c7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,23 @@ -FROM node:24-alpine AS deps -WORKDIR /app -COPY package.json ./ -RUN ls -la /app -#RUN mkdir frontend -#RUN mkdir lstDocs -#RUN mkdir controller -#COPY frontend/package*.json ./frontend -#COPY lstDocs/package*.json ./lstDocs -#COPY controller/index.html ./controller +FROM node:24.12-alpine -RUN npm install -#RUN npm run install:front -#RUN npm run install:docs - -# Build the Next.js app -FROM node:24-alpine AS builder WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -#COPY --from=deps /app/frontend/node_modules ./frontend/node_modules -#COPY --from=deps /app/lstDocs/node_modules ./lstDocs/node_modules -#COPY --from=deps /app/controller/index.html ./controller/index.html -#COPY . ./ -RUN npm run build:app -#RUN npm run build:front -#RUN npm run build:docs -# Final stage -FROM node:24-alpine -WORKDIR /app -COPY --from=builder /app/node_modules ./node_modules +# Copy package files +COPY package*.json ./ + +# Install production dependencies only +RUN npm ci + +RUN npm build:app + +# Copy built app from builder stage COPY --from=builder /app/dist ./dist -#COPY --from=builder /app/frontend/dist ./frontend/dist -#COPY --from=builder /app/lstDocs/build ./lstDocs/build -#COPY --from=deps /app/controller/index.html ./controller/index.html - -ENV NODE_ENV=production -ENV RUNNING_IN_DOCKER=true +# Environment variables with defaults ENV PORT=3000 +ENV DB_USER=admin +ENV DB_PASSWORD=changeme + EXPOSE 3000 + CMD ["node", "dist/index.js"] \ No newline at end of file diff --git a/Dockerfile-bak b/Dockerfile-bak new file mode 100644 index 0000000..c5413ae --- /dev/null +++ b/Dockerfile-bak @@ -0,0 +1,42 @@ +FROM node:24-alpine AS deps +WORKDIR /app +COPY package.json ./ +RUN ls -la /app +#RUN mkdir frontend +#RUN mkdir lstDocs +#RUN mkdir controller +#COPY frontend/package*.json ./frontend +#COPY lstDocs/package*.json ./lstDocs +#COPY controller/index.html ./controller + +RUN npm install +#RUN npm run install:front +#RUN npm run install:docs + +# Build the Next.js app +FROM node:24-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +#COPY --from=deps /app/frontend/node_modules ./frontend/node_modules +#COPY --from=deps /app/lstDocs/node_modules ./lstDocs/node_modules +#COPY --from=deps /app/controller/index.html ./controller/index.html +#COPY . ./ +RUN npm run build:app +#RUN npm run build:front +#RUN npm run build:docs + +# Final stage +FROM node:24-alpine +WORKDIR /app +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/dist ./dist +#COPY --from=builder /app/frontend/dist ./frontend/dist +#COPY --from=builder /app/lstDocs/build ./lstDocs/build +#COPY --from=deps /app/controller/index.html ./controller/index.html + + +ENV NODE_ENV=production +ENV RUNNING_IN_DOCKER=true +ENV PORT=3000 +EXPOSE 3000 +CMD ["node", "dist/index.js"] \ No newline at end of file