Perplexica/app.dockerfile

36 lines
789 B
Text
Raw Normal View History

#############################
# Build stage
#############################
2024-04-09 16:21:05 +05:30
FROM node:22-alpine AS builder
2024-04-09 16:21:05 +05:30
WORKDIR /app
2024-04-09 16:21:05 +05:30
# Copy package.json and yarn.lock
COPY ui/package.json ui/yarn.lock ./
2024-04-09 16:21:05 +05:30
# Copy the rest of the application code
COPY ui .
2024-04-09 16:21:05 +05:30
# Install dependencies & build the application
RUN yarn install --frozen-lockfile && yarn build
#############################
# Production stage
#############################
FROM node:22-alpine
WORKDIR /app
# Copy built assets from the builder stage
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/public ./public
# Run the Docker image as node instead of root
USER node
# Start the application
2024-04-09 16:21:05 +05:30
CMD ["yarn", "start"]