-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (47 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
70 lines (47 loc) · 1.25 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###################
# Build stage #
###################
FROM node:23-alpine AS build
# Set the working directory
WORKDIR /app
# Install Chromium and other dependencies
RUN apk add --no-cache \
udev \
ttf-freefont \
chromium
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install
# Copy the rest of the application code
COPY . .
# Generate Swagger docs
RUN node ace docs:generate
# Build the application
RUN npm run build
# Move the generated swagger.yml to the build folder
RUN cp swagger.yml build/
########################
# Production stage #
########################
FROM node:23-alpine
# Set the working directory
WORKDIR /app
# Install Chromium and other dependencies
RUN apk add --no-cache \
udev \
ttf-freefont \
chromium
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Copy the built application from the build stage
COPY --from=build /app/build ./build
WORKDIR /app/build
# Install only production dependencies
RUN npm install -g pnpm
RUN pnpm install --only=production
# Expose the port the app runs on
EXPOSE 3333
# Start the AdonisJS application
CMD ["node", "bin/server.js"]