mirror of
https://github.com/kind-0/nsecbunkerd.git
synced 2026-05-03 07:00:11 +00:00
Refactor Dockerfile for Node 18 and pnpm
Updated Dockerfile to use Node 18-alpine and streamline build process.
This commit is contained in:
parent
051f4acecc
commit
8c7648d330
40
Dockerfile
40
Dockerfile
@ -1,34 +1,28 @@
|
|||||||
FROM node:20.11-bullseye AS build
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
# Install pnpm
|
||||||
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files and install dependencies
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN pnpm install
|
|
||||||
|
|
||||||
# Copy application files
|
# Install dependencies
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Copy source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Generate prisma client and build the application
|
# Build
|
||||||
|
RUN pnpm run build
|
||||||
|
|
||||||
|
# Run prisma migrations
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Runtime stage
|
# Create config directory
|
||||||
FROM node:20.11-alpine as runtime
|
RUN mkdir -p /app/config
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENTRYPOINT [ "node", "./dist/index.js" ]
|
CMD ["node", "dist/index.js"]
|
||||||
CMD ["start"]
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user