From cbbe739b8201376db959e35212cb18b0f9d5d8f1 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Fri, 28 Jun 2024 17:42:10 -0300 Subject: [PATCH] Build image using docr --- src/faaso.cr | 5 ++++- templates/crystal/Dockerfile | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/faaso.cr b/src/faaso.cr index 7e3b789..cc4d1cd 100644 --- a/src/faaso.cr +++ b/src/faaso.cr @@ -1,4 +1,6 @@ require "commander" +require "docr" +require "docr/utils.cr" require "file_utils" require "uuid" @@ -29,8 +31,9 @@ module Faaso Dir.glob(arg + "/**/*").each do |file| FileUtils.cp(file, tmp_dir) end - # TODO: build Docker image + docker_api = Docr::API.new(Docr::Client.new) + docker_api.images.build(context: tmp_dir, tags: ["func"]) { } # TODO: push Docker image to registry # TODO: return image name for testing end diff --git a/templates/crystal/Dockerfile b/templates/crystal/Dockerfile index 20a8453..44fbefb 100644 --- a/templates/crystal/Dockerfile +++ b/templates/crystal/Dockerfile @@ -4,7 +4,7 @@ RUN apk update && apk upgrade && apk add crystal shards openssl-dev zlib-dev && WORKDIR /home/app -COPY shard.yml *.cr . +COPY shard.yml *.cr ./ RUN shards install RUN shards build