From 905082c7699eaa2ff3bf38c22ea0f17ac4e1a8d0 Mon Sep 17 00:00:00 2001 From: sneak Date: Sun, 20 Sep 2020 15:45:35 -0700 Subject: [PATCH] should work with CI now, untested --- .drone.yml | 13 +++++++++++++ Dockerfile | 21 +++++++++++++++++++++ Makefile | 8 ++++---- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..2ddc430 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,13 @@ +kind: pipeline +name: test-docker-build + +steps: +- name: test-docker-build + image: plugins/docker + network_mode: bridge + settings: + repo: sneak/formless + dry_run: true + tags: + - ${DRONE_COMMIT_SHA} + - ${DRONE_BRANCH} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9428210 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM golang:1.15 as builder + +RUN mkdir /build +ADD . /build/ +WORKDIR /build +RUN make build + + +FROM scratch + +COPY --from=builder /build/formless /app/formless +COPY --from=builder /go /goarchive + +WORKDIR /app + +ENV PORT 8080 +ENV DBURL none + +EXPOSE 8080 + +CMD ["./formless"] diff --git a/Makefile b/Makefile index c04cccf..c55806d 100644 --- a/Makefile +++ b/Makefile @@ -59,22 +59,22 @@ test: lint build-docker-image is_uncommitted: git diff --exit-code >/dev/null 2>&1 -build-docker-image: clean +docker-build: docker build -t $(IMAGENAME) . build-docker-image-dist: is_uncommitted clean docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) . -dist: lint build-docker-image +dist: lint docker-build -mkdir -p ./output docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN) docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2 hub: upload-docker-image -upload-docker-image: build-docker-image +upload-docker-image: docker-build docker push $(IMAGENAME):$(VERSION) docker push $(IMAGENAME):$(BUILDTIMETAG) docker push $(IMAGENAME):latest -.PHONY: build fmt test is_uncommitted build-docker-image dist hub upload-docker-image clean run rundebug default build-docker-image-dist +.PHONY: build fmt test is_uncommitted docker-build dist hub upload-docker-image clean run rundebug default build-docker-image-dist