-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
59 lines (43 loc) · 1.38 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Build stage
FROM node:23-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install -g pnpm
# OpenAPI generation stage
FROM base AS openapi-generator
WORKDIR /app
# Install OpenJDK for OpenAPI generator
RUN apt-get update && apt-get install -y openjdk-17-jdk
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Copy the rest of the files including the downloaded spec
COPY . .
# Generate OpenAPI code
RUN pnpm ci-gen-api
# Build stage
# ? Uses data compiled from the base stage
FROM base AS builder
WORKDIR /app
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --force
# Copy the rest of the files and generated OpenAPI code
COPY . .
COPY --from=openapi-generator /app/src/openapi ./src/openapi
# Build the application
RUN pnpm build
# Production stage
FROM base AS production
WORKDIR /app
# Copy built files and production dependencies
COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
COPY --from=builder /app/dist ./dist
# Copy Assets
COPY --from=builder /app/assets ./assets
# Install production dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --force
EXPOSE 2090
CMD ["pnpm", "start"]