-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathDockerfile
156 lines (126 loc) · 5.17 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
FROM node:18-alpine
ARG DEMO_DEMO_PATH
ARG DEMO_PACKAGES_CORE_PATH
ARG DEMO_PACKAGES_PATH
ARG DEMO_PACKAGES_REACT_PATH
ARG DEMO_PACKAGES_WEB_SDK_PATH
ARG DEMO_PACKAGES_WEB_TRACING_PATH
ARG DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH
ARG DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH
ARG DEMO_PORT
ARG DEMO_PORT_HMR
ARG DEMO_WORKSPACE_PATH
# Install Python in order to be able to build the native modules
ENV VIRTUAL_ENV=/opt/venv
RUN apk add --update --no-cache python3 make build-base && ln -sf python3 /usr/bin/python
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
# Set the workspace path
WORKDIR ${DEMO_WORKSPACE_PATH}
# Create a simple TS file that will be used to build the workspace initially
# This file will be copied in the src folder of each package and removed at the end
RUN echo "export {};" >> index.ts
# Copy files necessary for installing the dependencies
# Root
COPY .env \
lerna.json \
package.json \
rollup.config.base.js \
tsconfig.base.json \
tsconfig.base.cjs.json \
tsconfig.base.esm.json \
tsconfig.base.spec.json \
yarn.lock \
./
# Demo
COPY ${DEMO_DEMO_PATH}/package.json \
${DEMO_DEMO_PATH}/index.html \
${DEMO_DEMO_PATH}/
RUN mkdir -p ${DEMO_DEMO_PATH}/src/client ${DEMO_DEMO_PATH}/src/server
RUN cp index.ts ${DEMO_DEMO_PATH}/src/client/index.tsx
RUN cp index.ts ${DEMO_DEMO_PATH}/src/server
RUN touch index.scss ${DEMO_DEMO_PATH}/src/client
# Packages - Core
COPY ${DEMO_PACKAGES_CORE_PATH}/package.json \
${DEMO_PACKAGES_CORE_PATH}/rollup.config.js \
${DEMO_PACKAGES_CORE_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_CORE_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_CORE_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_CORE_PATH}/tsconfig.json \
${DEMO_PACKAGES_CORE_PATH}/
COPY ${DEMO_PACKAGES_CORE_PATH}/bin/genVersion.js \
${DEMO_PACKAGES_CORE_PATH}/bin/
RUN mkdir ${DEMO_PACKAGES_CORE_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_CORE_PATH}/src
# Packages - React
COPY ${DEMO_PACKAGES_REACT_PATH}/package.json \
${DEMO_PACKAGES_REACT_PATH}/rollup.config.js \
${DEMO_PACKAGES_REACT_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_REACT_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_REACT_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_REACT_PATH}/tsconfig.json \
${DEMO_PACKAGES_REACT_PATH}/
RUN mkdir ${DEMO_PACKAGES_REACT_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_REACT_PATH}/src
# Packages - Web Sdk
COPY ${DEMO_PACKAGES_WEB_SDK_PATH}/package.json \
${DEMO_PACKAGES_WEB_SDK_PATH}/rollup.config.js \
${DEMO_PACKAGES_WEB_SDK_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_WEB_SDK_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_WEB_SDK_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_WEB_SDK_PATH}/tsconfig.json \
${DEMO_PACKAGES_WEB_SDK_PATH}/
RUN mkdir ${DEMO_PACKAGES_WEB_SDK_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_WEB_SDK_PATH}/src
# Packages - Web Tracing
COPY ${DEMO_PACKAGES_WEB_TRACING_PATH}/package.json \
${DEMO_PACKAGES_WEB_TRACING_PATH}/rollup.config.js \
${DEMO_PACKAGES_WEB_TRACING_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_WEB_TRACING_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_WEB_TRACING_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_WEB_TRACING_PATH}/tsconfig.json \
${DEMO_PACKAGES_WEB_TRACING_PATH}/
RUN mkdir ${DEMO_PACKAGES_WEB_TRACING_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_WEB_TRACING_PATH}/src
# Packages - Experimental Fetch Instrumentation
COPY ${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/package.json \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/rollup.config.js \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/tsconfig.json \
${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/
RUN mkdir ${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_FETCH_INSTRUMENTATION_PATH}/src
# Packages - Experimental XHR Instrumentation
COPY ${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/package.json \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/rollup.config.js \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/tsconfig.cjs.json \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/tsconfig.esm.json \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/tsconfig.spec.json \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/tsconfig.json \
${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/
RUN mkdir ${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/src
RUN cp index.ts ${DEMO_PACKAGES_XHR_INSTRUMENTATION_PATH}/src
RUN rm index.ts
# Install external dependencies
# In order to save some time, we install the external dependencies first
# And later we rebuild everything
RUN SKIP_GEN_VERSION=1 yarn install --pure-lockfile
# Add the rest of the files necessary for internal dependencies
# Demo
COPY ${DEMO_DEMO_PATH} \
${DEMO_DEMO_PATH}/
# Packages
COPY ${DEMO_PACKAGES_PATH}/ \
${DEMO_PACKAGES_PATH}/
# Build the packages
RUN yarn clean
RUN yarn build
# Expose the ports
EXPOSE ${DEMO_PORT}
EXPOSE ${DEMO_PORT_HMR}
# Start the demo
CMD ["yarn", "start"]