From 21d7c5724f054b9efcc80ab4b7ae4dffbedd05d1 Mon Sep 17 00:00:00 2001 From: rabble Date: Mon, 9 Dec 2024 22:11:27 +1300 Subject: [PATCH] making it so docker actually builds with release vs dev versions of ndk --- Dockerfile | 29 ++++++++++++----------------- package.json | 2 +- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1eb99be..eb07271 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,29 @@ FROM node:20.11-bullseye AS build - WORKDIR /app -# Copy package files and install dependencies +# Copy and install all dependencies COPY package*.json ./ -RUN npm install - -# Copy application files +COPY tsconfig*.json ./ +RUN npm install -g npm@latest && npm install COPY . . - -# Generate prisma client and build the application RUN npx prisma generate RUN npm run build -# Runtime stage +# Optional: prune dev dependencies after build +RUN npm prune --omit=dev + FROM node:20.11-alpine as runtime - WORKDIR /app - RUN apk update && \ apk add --no-cache openssl && \ rm -rf /var/cache/apk/* -# Copy built files from the build stage -COPY --from=build /app . - -# Install only runtime dependencies -RUN npm install --only=production +# Copy only what is needed +COPY --from=build /app/package*.json ./ +COPY --from=build /app/node_modules ./node_modules +COPY --from=build /app/dist ./dist +COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma EXPOSE 3000 - ENTRYPOINT [ "node", "./dist/index.js" ] -CMD ["start"] +CMD ["start"] \ No newline at end of file diff --git a/package.json b/package.json index 4232435..8709a20 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@fastify/view": "^8.2.0", "@inquirer/password": "^1.1.2", "@inquirer/prompts": "^1.2.3", - "@nostr-dev-kit/ndk": "workspace:*", + "@nostr-dev-kit/ndk": "^2.10.7", "@prisma/client": "^5.4.1", "@scure/base": "^1.1.1", "@types/yargs": "^17.0.24",