summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2018-12-05 11:37:54 +0100
committerPatrick Spek <p.spek@tyil.nl>2018-12-05 11:37:54 +0100
commitbc8b5802771709b62decc47862c19c4c7eab16f4 (patch)
tree8caa5a455ae448b543ca62087a34709725e6217c /bin
parent822a2a28f3f42cdc351ffa2d40c823400c44621f (diff)
Add Dockerfile
Diffstat (limited to 'bin')
-rwxr-xr-xbin/make-docker16
-rwxr-xr-xbin/make-mimetypes36
2 files changed, 52 insertions, 0 deletions
diff --git a/bin/make-docker b/bin/make-docker
new file mode 100755
index 0000000..9a1a156
--- /dev/null
+++ b/bin/make-docker
@@ -0,0 +1,16 @@
+#! /usr/bin/env perl6
+
+use v6.c;
+
+#| Create a docker image of the blog.
+sub MAIN (
+ #| The tag to use for the docker image.
+ Str:D :$tag = "tyil/blog:latest",
+) {
+ my IO::Path $basedir = $*PROGRAM.resolve.parent(2);
+ chdir $basedir;
+
+ run « bundle »;
+ run « bundle exec jekyll build »;
+ run « docker build -t "$tag" . »;
+}
diff --git a/bin/make-mimetypes b/bin/make-mimetypes
new file mode 100755
index 0000000..64c9120
--- /dev/null
+++ b/bin/make-mimetypes
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl6
+
+use v6.c;
+
+sub MAIN (
+ Str:D :$default = "application/octet-stream",
+) {
+ my IO::Path $mime-types = "/etc/mime.types".IO;
+
+ die "No $mime-types.absolute()" unless $mime-types.f;
+
+ my %types;
+
+ for $mime-types.lines -> $line {
+ my ($mimetype, @extensions) = $line.words;
+
+ for @extensions -> $extension {
+ %types{$extension} = $mimetype;
+ }
+ }
+
+ print-conf(%types, $default);
+}
+
+sub print-conf (
+ %mimetypes,
+ Str:D $default,
+) {
+ say "mimetype.assign = (";
+
+ for %mimetypes.kv -> $extension, $type {
+ say "\t\".$extension\" => \"$type\",";
+ }
+
+ say "\"\" => \"$default\"\n)";
+}