Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reorganize project layout #190

Merged
merged 1 commit into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
vendor/
30 changes: 25 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
FROM golang:1.13-alpine as build
# dynamic config
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION

# build
FROM golang:1.13-alpine as build
RUN apk add --update --no-cache git gcc musl-dev make
ADD . /go/src/moul.io/depviz
WORKDIR /go/src/moul.io/depviz
RUN GO111MODULE=on go get -v .
RUN GO111MODULE=on make install
ENV GO111MODULE=on
COPY go.* ./
RUN go mod download
COPY . ./
RUN make install

FROM alpine
# minimalist runtime
FROM alpine:3.10
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="depviz" \
org.label-schema.description="" \
org.label-schema.url="https://moul.io/depviz/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/moul/depviz" \
org.label-schema.vendor="Manfred Touron" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0" \
org.label-schema.cmd="docker run -i -t --rm moul/depviz" \
org.label-schema.help="docker exec -it $CONTAINER depviz --help"
RUN apk add --update --no-cache ca-certificates
COPY --from=build /go/bin/depviz /bin/
ENTRYPOINT ["depviz"]
53 changes: 52 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
GOPKG ?= moul.io/depviz
GOBINS ?= . ./tools/opml-to-github-issues ./tools/sed-i-github-issues
GOBINS = ./cmd/depviz
#GOBINS += ./tools/opml-to-github-issues
#GOBINS += ./tools/sed-i-github-issues
DOCKER_IMAGE ?= moul/depviz


all: test install


PRE_INSTALL_STEPS += generate
PRE_TEST_STEPS += generate
PRE_BUILD_STEPS += generate
PRE_LING_STEPS += generate
PRE_BUMPDEPS_STEPS += generate
include rules.mk


.PHONY: update_examples
update_examples:
for dir in $(sort $(dir $(wildcard examples/*/*))); do (cd $$dir && make); done
@echo "now you can run:"
@echo " git commit examples -m \"chore: update examples\""


##
## generate
##


PROTOS_SRC := $(wildcard ./api/*.proto) $(wildcard ./api/internal/*.proto)
GEN_SRC := $(PROTOS_SRC) Makefile
.PHONY: generate
generate: gen.sum
gen.sum: $(GEN_SRC)
shasum $(GEN_SRC) | sort > gen.sum.tmp
diff -q gen.sum gen.sum.tmp || ( \
set -e; \
GO111MODULE=on go mod vendor; \
docker run \
--user=`id -u` \
--volume="$(PWD):/go/src/moul.io/depviz" \
--workdir="/go/src/moul.io/depviz" \
--entrypoint="sh" \
--rm \
moul/depviz-protoc:1 \
-xec 'make generate_local'; \
make tidy \
)


.PHONY: generate_local
generate_local:
@set -e; for proto in $(PROTOS_SRC); do ( set -xe; \
protoc -I ./api:./vendor:/protobuf --grpc-gateway_out=logtostderr=true:"$(GOPATH)/src" --gogofaster_out="plugins=grpc:$(GOPATH)/src" "$$proto" \
); done
goimports -w ./pkg ./cmd ./internal
shasum $(GEN_SRC) | sort > gen.sum.tmp
mv gen.sum.tmp gen.sum


.PHONY: clean
clean:
rm -f gen.sum $(wildcard */*/*.pb.go */*/*.pb.gw.go) $(wildcard out/*)
89 changes: 0 additions & 89 deletions airtable/cmd_airtable.go

This file was deleted.

69 changes: 0 additions & 69 deletions airtable/cmd_airtable_info.go

This file was deleted.

Loading