File tree 3 files changed +11
-5
lines changed
3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
FROM nginx:stable-alpine
2
2
3
+ RUN apk add --update coreutils
4
+
3
5
RUN apk add --no-cache nodejs yarn
4
6
5
7
RUN yarn global add @beam-australia/react-env
Original file line number Diff line number Diff line change @@ -6,17 +6,21 @@ echo "Serializing environment:"
6
6
7
7
react-env --dest .
8
8
9
- # save content of env.js as it will be removed.
10
- subs=$( cat env.js)
9
+ envs=$( cat env.js)
11
10
12
- rm env.js
11
+ echo " $envs "
12
+
13
+ # save content of env.js as it will be removed.
14
+ subs=" data:text/javascript;base64,$( base64 -w 0 env.js) "
13
15
14
16
echo " $subs "
15
17
18
+ rm env.js
19
+
16
20
# cat /var/www/index.html
17
21
18
22
# Substitute the script with src by an equivalent inline script.
19
- sed -i " s~ <script src=\" /env.js\" ></script>~ <script> ${subs} </script>~ " /var/www/index.html
23
+ sed -i " s| <script src=\" /env.js\" ></script>| <script src= \" ${subs} \" > </script>| " /var/www/index.html
20
24
21
25
# echo 'After substitution'
22
26
# cat /var/www/index.html
Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="UTF-8 " />
5
5
< title > TypeScript React Starter</ title >
6
- < script src ="env.js "> </ script >
6
+ < script src ="/ env.js "> </ script >
7
7
</ head >
8
8
< body > </ body >
9
9
</ html >
You can’t perform that action at this time.
0 commit comments