FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-node/stackbrew.js at main · nodejs/docker-node · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
nodejs
/
docker-node
Public
Notifications
You must be signed in to change notification settings
Fork
2k
Star
8.6k
Code
Issues
34
Pull requests
8
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-node
/
stackbrew.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
172 lines (153 loc) · 5.26 KB
Breadcrumbs
docker-node
/
stackbrew.js
Copy path
File metadata and controls
executable file
·
172 lines (153 loc) · 5.26 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env node
const
fs
=
require
(
'fs'
)
;
const
path
=
require
(
'path'
)
;
// Grab last git commit
function
getCommitHasForPath
(
path
)
{
return
require
(
'child_process'
)
.
execSync
(
`git log -1 --format=%H HEAD --
${
path
}
`
)
.
toString
(
)
.
trim
(
)
;
}
const
stackbrewPath
=
path
.
basename
(
__filename
)
;
// Header
let
stackbrew
=
`# this file is generated via https://github.com/nodejs/docker-node/blob/
${
getCommitHasForPath
(
stackbrewPath
)
}
/
${
stackbrewPath
}
Maintainers: The Node.js Docker Team <https://github.com/nodejs/docker-node> (@nodejs)
GitRepo: https://github.com/nodejs/docker-node.git
GitFetch: refs/heads/main\n`
;
// Loop versions
const
config
=
require
(
'./versions.json'
)
;
const
versions
=
Object
.
keys
(
config
)
.
reverse
(
)
;
let
midnight
=
new
Date
(
)
;
midnight
.
setHours
(
0
,
0
,
0
,
0
)
;
const
now
=
midnight
.
getTime
(
)
;
const
alpineRE
=
new
RegExp
(
/
a
l
p
i
n
e
*
/
)
;
const
slimRE
=
new
RegExp
(
/
\*
-
s
l
i
m
/
)
;
let
foundLTS
=
false
;
let
foundCurrent
=
false
;
for
(
const
version
of
versions
)
{
let
lts
=
new
Date
(
`
${
config
[
version
]
.
lts
}
T00:00:00.00`
)
.
getTime
(
)
;
let
isCurrent
=
foundCurrent
?
false
:
isNaN
(
lts
)
||
lts
>=
now
;
foundCurrent
=
isCurrent
||
foundCurrent
;
let
isLTS
=
foundLTS
?
false
:
now
>=
lts
;
foundLTS
=
isLTS
||
foundLTS
;
let
codename
=
config
[
version
]
.
codename
;
let
defaultAlpine
=
config
[
version
]
[
'alpine-default'
]
;
let
defaultDebian
=
config
[
version
]
[
'debian-default'
]
;
let
variants
=
config
[
version
]
.
variants
;
for
(
const
variant
in
variants
)
{
let
dockerfilePath
=
path
.
join
(
version
,
variant
,
'Dockerfile'
)
;
let
isAlpine
=
alpineRE
.
test
(
variant
)
;
let
isSlim
=
slimRE
.
test
(
variant
)
;
let
isDefaultSlim
=
new
RegExp
(
`
${
defaultDebian
}
-slim`
)
.
test
(
variant
)
;
// Get full version from the Dockerfile
let
dockerfile
=
fs
.
readFileSync
(
dockerfilePath
,
'utf-8'
)
;
let
fullVersion
=
dockerfile
.
match
(
/
E
N
V
N
O
D
E
_
V
E
R
S
I
O
N
=
(?<
major
>
\d
+
)
\.
(?<
minor
>
\d
+
)
\.
(?<
patch
>
\d
+
)
/
,
)
;
let
tags
=
[
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
-
${
variant
}
`
,
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
-
${
variant
}
`
,
`
${
fullVersion
.
groups
.
major
}
-
${
variant
}
`
,
]
;
if
(
codename
)
{
tags
.
push
(
`
${
codename
}
-
${
variant
}
`
)
;
}
if
(
variant
===
defaultAlpine
)
{
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
-alpine`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
-alpine`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
-alpine`
)
;
if
(
codename
)
{
tags
.
push
(
`
${
codename
}
-alpine`
)
;
}
}
if
(
variant
===
defaultDebian
)
{
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
`
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
`
)
;
if
(
isSlim
)
{
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
-slim`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
-slim`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
-slim`
)
;
}
if
(
codename
)
{
tags
.
push
(
`
${
codename
}
`
)
;
}
}
if
(
isDefaultSlim
)
{
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
-slim`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
-slim`
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
-slim`
)
;
if
(
codename
)
{
tags
.
push
(
`
${
codename
}
-slim`
)
;
}
}
if
(
isCurrent
)
{
if
(
variant
===
defaultAlpine
)
{
tags
.
push
(
variant
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
.
${
fullVersion
.
groups
.
patch
}
-alpine`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
.
${
fullVersion
.
groups
.
minor
}
-alpine`
,
)
;
tags
.
push
(
`
${
fullVersion
.
groups
.
major
}
-alpine`
)
;
tags
.
push
(
'alpine'
)
;
tags
.
push
(
'current-alpine'
)
;
}
if
(
variant
===
defaultDebian
)
{
tags
.
push
(
variant
)
;
tags
.
push
(
'latest'
)
;
tags
.
push
(
'current'
)
;
}
if
(
isAlpine
)
{
tags
.
push
(
`
${
variant
}
`
)
;
tags
.
push
(
`current-
${
variant
}
`
)
;
}
if
(
!
isAlpine
)
{
tags
.
push
(
`
${
variant
}
`
)
;
tags
.
push
(
`current-
${
variant
}
`
)
;
}
if
(
isDefaultSlim
)
{
tags
.
push
(
'slim'
)
;
tags
.
push
(
'current-slim'
)
;
}
}
if
(
isLTS
)
{
tags
.
push
(
`lts-
${
variant
}
`
)
;
if
(
variant
===
defaultDebian
)
{
tags
.
push
(
'lts'
)
;
if
(
codename
)
{
tags
.
push
(
`lts-
${
codename
}
`
)
;
}
}
if
(
isDefaultSlim
)
{
tags
.
push
(
`lts-slim`
)
;
}
if
(
variant
===
defaultAlpine
)
{
tags
.
push
(
`lts-alpine`
)
;
}
}
// remove duplicates
tags
=
tags
.
filter
(
(
x
,
i
,
a
)
=>
a
.
indexOf
(
x
)
==
i
)
;
tags
=
tags
.
sort
(
)
;
let
directory
=
`
${
version
}
/
${
variant
}
`
;
stackbrew
+=
`\nTags:
${
tags
.
join
(
', '
)
}
\n`
;
stackbrew
+=
`Architectures:
${
config
[
version
]
.
variants
[
variant
]
.
join
(
', '
)
}
\n`
;
stackbrew
+=
`GitCommit:
${
getCommitHasForPath
(
directory
)
}
\n`
;
stackbrew
+=
`Directory:
${
directory
}
\n`
;
}
}
// output
console
.
log
(
stackbrew
)
;
Back
|
FazBrowse Home
|
New Git URL