From d825bb144bf554934386df57f2e14750f4abbf56 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 2 May 2021 17:42:11 -0500 Subject: [PATCH] docker: add rake task for building Docker image. Add a Rake task for building a Docker image. Usage: * bin/rails danbooru:docker:build * sudo docker run --rm -it danbooru --- lib/tasks/danbooru.rake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/tasks/danbooru.rake diff --git a/lib/tasks/danbooru.rake b/lib/tasks/danbooru.rake new file mode 100644 index 000000000..0cc9fc11c --- /dev/null +++ b/lib/tasks/danbooru.rake @@ -0,0 +1,10 @@ +namespace :danbooru do + namespace :docker do + # Note that uncommited changes won't be included in the image; commit + # changes first before building the image. + desc "Build a Docker image based on latest commit" + task :build do + system("git archive HEAD | docker build - --build-arg SOURCE_COMMIT=$(git rev-parse HEAD) -t danbooru -f Dockerfile") + end + end +end