mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-05 10:35:18 +02:00
Add dockerfile
This commit is contained in:
parent
a67463a518
commit
13ddcafda4
9 changed files with 158 additions and 13 deletions
38
Dockerfile
Normal file
38
Dockerfile
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Stage 1: Build the application
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Build the Next.js application and compile TypeScript
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Run the application
|
||||
FROM node:18-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install only production dependencies
|
||||
RUN npm ci --only=production
|
||||
|
||||
# Copy built application from the builder stage
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Expose the ports the app runs on
|
||||
EXPOSE ${EXTERNAL_PORT}
|
||||
EXPOSE ${INTERNAL_PORT}
|
||||
|
||||
# Start the application
|
||||
CMD ["npm", "start"]
|
Loading…
Add table
Add a link
Reference in a new issue