-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile_apimanager
More file actions
53 lines (43 loc) · 1.72 KB
/
Dockerfile_apimanager
File metadata and controls
53 lines (43 loc) · 1.72 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
FROM node:22-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
# Copy monorepo root manifests and install all workspace dependencies
COPY package*.json ./
COPY apps/portal/package*.json ./apps/portal/
COPY apps/api-manager/package*.json ./apps/api-manager/
COPY packages/shared/package*.json ./packages/shared/
RUN npm ci
# Copy full source
COPY packages/shared/ ./packages/shared/
COPY apps/api-manager/ ./apps/api-manager/
# Accept build arguments for environment variables
# (PUBLIC_* vars are read at runtime via $env/dynamic/public, so they are
# not needed at build time and must be set on the running container instead.)
ARG OBP_OAUTH_CLIENT_ID
ARG OBP_OAUTH_CLIENT_SECRET
ARG APP_CALLBACK_URL
ARG ORIGIN
# Build provenance: the .git directory is not copied into the image, so the commit
# and branch must be passed in (CI sets these from $GITHUB_SHA / the ref name).
ARG GIT_COMMIT
ARG GIT_BRANCH
# Set environment variables for build
ENV OBP_OAUTH_CLIENT_ID=$OBP_OAUTH_CLIENT_ID
ENV OBP_OAUTH_CLIENT_SECRET=$OBP_OAUTH_CLIENT_SECRET
ENV APP_CALLBACK_URL=$APP_CALLBACK_URL
ENV ORIGIN=$ORIGIN
ENV GIT_COMMIT=$GIT_COMMIT
ENV GIT_BRANCH=$GIT_BRANCH
# Generate .svelte-kit/ for shared package so its tsconfig.json can resolve during the app build
RUN npm run prepare --workspace=packages/shared
# Build the api-manager app (shared package source is consumed directly via workspace symlink)
RUN npm run build --workspace=apps/api-manager
RUN npm prune --production
FROM node:22-alpine
WORKDIR /app
COPY --from=builder /app/apps/api-manager/build ./build/
COPY --from=builder /app/node_modules ./node_modules/
COPY --from=builder /app/apps/api-manager/package.json ./package.json
EXPOSE 3003
ENV NODE_ENV=production
CMD [ "node", "build" ]