-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (30 loc) · 961 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
39
40
41
42
43
ARG NODE_VERSION=23.1.0
# Create build stage
FROM node:${NODE_VERSION}-slim AS build
# Enable npm
ENV NPM_HOME="/npm"
ENV PATH="$NPM_HOME:$PATH"
RUN corepack enable
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and pnpm-lock.yaml files to the working directory
COPY ./package.json /app/
## Install dependencies
RUN npm install --shamefully-hoist
# Copy the rest of the application files to the working directory
COPY . ./
# Build the application
RUN npm run build
# Create a new stage for the production image
FROM node:${NODE_VERSION}-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the output from the build stage to the working directory
COPY --from=build /app/.output ./
# Define environment variables
ENV HOST=0.0.0.0 NODE_ENV=production
ENV NODE_ENV=production
# Expose the port the application will run on
EXPOSE 3000
# Start the application
CMD ["node","/app/server/index.mjs"]