forked from uncefact/project-vckit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
133 lines (103 loc) · 5.93 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Stage 1: Build
FROM node:20 as build
WORKDIR /app
# Copy necessary files
COPY package.json .
COPY pnpm-lock.yaml .
COPY pnpm-workspace.yaml .
COPY lerna.json .
COPY packages/cli/default/agent.template.yml .
COPY entrypoint.sh .
COPY packages/tsconfig.json packages/
COPY packages/tsconfig.settings.json packages/
# Copy package.json for each package
COPY packages/bitstringStatusList/package.json packages/bitstringStatusList/
COPY packages/cli/package.json packages/cli/
COPY packages/core-types/package.json packages/core-types/
COPY packages/credential-merkle-disclosure-proof/package.json packages/credential-merkle-disclosure-proof/
COPY packages/credential-oa/package.json packages/credential-oa/
COPY packages/credential-router/package.json packages/credential-router/
COPY packages/encrypted-storage/package.json packages/encrypted-storage/
COPY packages/example-documents/package.json packages/example-documents/
COPY packages/oauth-middleware/package.json packages/oauth-middleware/
COPY packages/remote-server/package.json packages/remote-server/
COPY packages/renderer/package.json packages/renderer/
COPY packages/revocation-list-2020/package.json packages/revocation-list-2020/
COPY packages/tools/package.json packages/tools/
COPY packages/utils/package.json packages/utils/
COPY packages/vc-api/package.json packages/vc-api/
# Install dependencies
RUN npm install -g pnpm@8.14.0
RUN pnpm install
# Copy the source code of each package
COPY packages/bitstringStatusList/ packages/bitstringStatusList/
COPY packages/cli/ packages/cli/
COPY packages/core-types/ packages/core-types/
COPY packages/credential-merkle-disclosure-proof/ packages/credential-merkle-disclosure-proof/
COPY packages/credential-oa/ packages/credential-oa/
COPY packages/credential-router/ packages/credential-router/
COPY packages/encrypted-storage/ packages/encrypted-storage/
COPY packages/example-documents/ packages/example-documents/
COPY packages/oauth-middleware/ packages/oauth-middleware/
COPY packages/remote-server/ packages/remote-server/
COPY packages/renderer/ packages/renderer/
COPY packages/revocation-list-2020/ packages/revocation-list-2020/
COPY packages/tools/ packages/tools/
COPY packages/utils/ packages/utils/
COPY packages/vc-api/ packages/vc-api/
# Build the project
RUN pnpm build
# Stage 2: Run
FROM node:20-alpine as vckit-api
WORKDIR /app
RUN apk update && apk add
# Update package lists and install gettext and git
RUN apk update && \
apk add gettext git
COPY --from=build /app/agent.template.yml ./agent.template.yml
# Copy built artifacts and node_modules from the build stage
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/.tmp_npm ./.tmp_npm
COPY --from=build /app/packages/bitstringStatusList/build/ packages/bitstringStatusList/build/
COPY --from=build /app/packages/bitstringStatusList/node_modules/ packages/bitstringStatusList/node_modules/
COPY --from=build /app/packages/bitstringStatusList/package.json packages/bitstringStatusList/package.json
COPY --from=build /app/packages/cli/build/ packages/cli/build/
COPY --from=build /app/packages/cli/node_modules/ packages/cli/node_modules/
COPY --from=build /app/packages/cli/package.json packages/cli/package.json
COPY --from=build /app/packages/core-types/build/ packages/core-types/build/
COPY --from=build /app/packages/credential-merkle-disclosure-proof/build/ packages/credential-merkle-disclosure-proof/build/
COPY --from=build /app/packages/credential-router/build/ packages/credential-router/build/
COPY --from=build /app/packages/credential-router/node_modules/ packages/credential-router/node_modules/
COPY --from=build /app/packages/credential-router/package.json packages/credential-router/package.json
COPY --from=build /app/packages/encrypted-storage/build/ packages/encrypted-storage/build/
COPY --from=build /app/packages/encrypted-storage/node_modules/ packages/encrypted-storage/node_modules/
COPY --from=build /app/packages/encrypted-storage/package.json packages/encrypted-storage/package.json
COPY --from=build /app/packages/example-documents/build/ packages/example-documents/build
COPY --from=build /app/packages/remote-server/build/ packages/remote-server/build/
COPY --from=build /app/packages/remote-server/node_modules/ packages/remote-server/node_modules/
COPY --from=build /app/packages/remote-server/package.json packages/remote-server/package.json
COPY --from=build /app/packages/renderer/build/ packages/renderer/build/
COPY --from=build /app/packages/renderer/node_modules/ packages/renderer/node_modules/
COPY --from=build /app/packages/renderer/package.json packages/renderer/package.json
COPY --from=build /app/packages/revocation-list-2020/build/ packages/revocation-list-2020/build/
COPY --from=build /app/packages/revocation-list-2020/node_modules/ packages/revocation-list-2020/node_modules/
COPY --from=build /app/packages/revocation-list-2020/package.json packages/revocation-list-2020/package.json
COPY --from=build /app/packages/tools/build/ packages/tools/build/
COPY --from=build /app/packages/tools/node_modules/ packages/tools/node_modules/
COPY --from=build /app/packages/tools/package.json packages/tools/package.json
COPY --from=build /app/packages/utils/build/ packages/utils/build/
COPY --from=build /app/packages/utils/node_modules/ packages/utils/node_modules/
COPY --from=build /app/packages/utils/package.json packages/utils/package.json
COPY --from=build /app/packages/vc-api/build/ packages/vc-api/build/
COPY --from=build /app/packages/vc-api/node_modules/ packages/vc-api/node_modules/
COPY --from=build /app/packages/vc-api/package.json packages/vc-api/package.json
COPY --from=build /app/packages/vc-api/src/vc-api-schemas/vc-api.yaml packages/vc-api/src/vc-api-schemas/vc-api.yaml
# Add an entrypoint script to the image
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
# Specify the script to run on container start
ENTRYPOINT ["./entrypoint.sh"]
# Expose the port
EXPOSE ${PORT}
# Command to run the application
CMD [ "node", "packages/cli/build/cli.js", "server" ]