forked from pollinations/gateway
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (36 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
50 lines (36 loc) · 1.14 KB
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
44
45
46
47
48
49
50
# Use the official Node.js runtime as a parent image
FROM node:20-alpine AS build
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
COPY patches ./
# Upgrade system packages
RUN apk upgrade --no-cache
# Upgrade npm to version 10.9.2
RUN npm install -g npm@10.9.2
# Install app dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application and clean up
RUN npm run build \
&& rm -rf node_modules \
&& npm install --omit=dev
# Use the official Node.js runtime as a parent image
FROM node:20-alpine
# Upgrade system packages
RUN apk upgrade --no-cache
# Upgrade npm to version 10.9.2
RUN npm install -g npm@10.9.2
# Set the working directory in the container
WORKDIR /app
# Copy the build directory, node_modules, and package.json to the working directory
COPY --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/patches /app/patches
# Expose port 8787
EXPOSE 8787
ENTRYPOINT ["npm"]
CMD ["run", "start:node"]