Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Makefile: add docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed Dec 20, 2019
1 parent 716977c commit d17838c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pre_compute_multiplications.gob
# built
/cmd/client/client
/cmd/server/server
/cmd/server/server-static

# cloned
/Coding
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DEFAULT_GOAL := all

DOCKER_IMAGE ?= ldsec/drynx:latest

Coding/bin/Makefile.base:
git clone https://github.com/dedis/Coding
include Coding/bin/Makefile.base
Expand All @@ -16,5 +18,14 @@ cmd/$1/$1: cmd/$1/*.go $(wildcard */*.go */*/*.go */*/*/*.go)
endef
$(foreach c,$(go-cmds),$(eval $(call go-cmd-build,$c)))

.PHONY: cmds
cmds: $(foreach c,$(go-cmds),cmd/$c/$c)

cmd/server/server-static: cmd/server/*.go $(wildcard */*.go */*/*.go */*/*/*.go)
CGO_ENABLED=0 go build -o $@ ./$(<D)
.PHONY: docker
docker: cmd/server/server-static
docker build -t $(DOCKER_IMAGE) $(<D)

.PHONY: all
all: $(foreach c,$(go-cmds),cmd/$c/$c)
all: cmds
8 changes: 8 additions & 0 deletions cmd/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM scratch

COPY ./server-static /server

# as no other directory exists
ENV TMPDIR=/

ENTRYPOINT ["/server"]

0 comments on commit d17838c

Please sign in to comment.