forked from mckaywrigley/chatbot-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (27 loc) · 969 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use the Node.js official image as a parent image
# FROM node:20
FROM node:21.5.0-bookworm
# Create a non-root user and switch to it
# RUN adduser --disabled-password myuser
# USER myuser
# Set the working directory in the container
WORKDIR /usr/src/app
# # Set ownership of the working directory to the non-root user
# RUN chown -R myuser:myuser /usr/src/app
# # Set appropriate permissions
# RUN chmod -R 755 /usr/src/app
# Copy package.json and package-lock.json (or yarn.lock) to the container working directory
COPY package*.json ./
# Install dependencies in production mode (without dev dependencies)
RUN npm cache clean -f
RUN npm ci
# Copy the rest of the application to the container working directory
COPY . .
# Build the Next.js application
RUN npm run build
# Set the environment to production to reduce Next.js application size
ENV NODE_ENV production
# Expose the port the app runs on
EXPOSE 3000
# Command to run the app
CMD ["npm", "start"]