-
Notifications
You must be signed in to change notification settings - Fork 3
/
generate_dockerfile.raku
36 lines (31 loc) · 1.18 KB
/
generate_dockerfile.raku
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
# Generate Dockerfile with Raku
sub MAIN() {
my $file = 'Dockerfile';
my $texlive_version;
my @years=2018..2020;
my $prompt = "Which version of texlive version do you want in your Dockerfile? \n";
if $file.IO.e {
my $answer=prompt("$file exists. Do you want to overwrite existing $file? \n");
if $answer ~~/:i y|yes/ {
$texlive_version=prompt($prompt);
} elsif $answer ~~/:i N|No/ {
exit
} else {
say "I did not get what that means! :)"
}
} elsif !$file.IO.e {
$texlive_version=prompt($prompt);
}
if $texlive_version ~~/<@years>/ {
my $dockerfile=qq:to/END/;
FROM sumankhanal/texlive-$texlive_version\:small
RUN tlmgr option repository http://ftp.math.utah.edu/pub/tex/historic/systems/texlive/$texlive_version/tlnet-final/ \\
&& tlmgr update --self \\
&& tlmgr install moderncv fontawesome5 academicons multirow arydshln
END
$file.IO.spurt: $dockerfile;
say "Dockerfile generated."
} else {
say "Invalid year. Choose from "~ @years.join(" or ")
}
}