diff --git a/.dockerignore b/.dockerignore index 0c20ebb..4df2ec4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,7 @@ LICENSE Dockerfile spec/ -bin/ \ No newline at end of file +bin/ +Makefile +.dockerignore +*.Dockerfile \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..98a984e --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path)))) + +release: + # Build a static binary and save it in muse-dl-static + docker build --tag muse-dl-static --file static.Dockerfile . + # Then extract the image | extract the layer.tar file (we only have one layer) | extract the muse-dl-static file + docker image save muse-dl-static | tar xf - --wildcards "*/layer.tar" -O | tar xf - "muse-dl-static" + # And move it to the bin/ directory + mv -f muse-dl-static bin/ \ No newline at end of file diff --git a/static.Dockerfile b/static.Dockerfile index 5201417..ac47121 100644 --- a/static.Dockerfile +++ b/static.Dockerfile @@ -9,4 +9,4 @@ RUN shards install && \ FROM scratch -COPY --from=builder /build/bin/muse-dl /muse-dl \ No newline at end of file +COPY --from=builder /build/bin/muse-dl /muse-dl-static \ No newline at end of file