Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in WIP docker-compose with lets-encrypt and nginx proxying. Vendo…
…rize go deps.
- Loading branch information
Showing
6 changed files
with
2,975 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
NGINX_CONF_PATH= | ||
STATIC_FILES_PATH= | ||
VIRTUAL_HOST=localhost | ||
LETSENCRYPT_HOST= | ||
LETSENCRYPT_EMAIL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
bin | ||
vendor/**/ | ||
nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,55 @@ | ||
GOLANG_VERSION := 1.9 | ||
PROJECT_OWNER := algolia | ||
PROJECT_PATH := src/github.com/$(PROJECT_OWNER)/sup3rs3cretMes5age | ||
TARGET_OS ?= linux | ||
|
||
deps: | ||
@go get -u github.com/hashicorp/vault | ||
@go get -u github.com/labstack/echo | ||
@go get -u github.com/dgrijalva/jwt-go | ||
$(GOPATH)/bin/govendor: | ||
@go get -u github.com/kardianos/govendor | ||
|
||
bin/sup3rs3cretMes5age: deps | ||
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $@ | ||
.PHONY: vendor | ||
vendor: $(GOPATH)/bin/govendor | ||
@govendor sync | ||
|
||
bin/sup3rs3cretMes5age: vendor | ||
@CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=amd64 go build -o $@ | ||
|
||
nginx/certs: | ||
@mkdir -p $@ | ||
|
||
nginx/certs/default.crt: nginx/certs | ||
@openssl req \ | ||
-x509 \ | ||
-newkey rsa:4096 \ | ||
-days 365 \ | ||
-keyout nginx/certs/default.key \ | ||
-nodes \ | ||
-subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=localhost" \ | ||
-out $@ | ||
|
||
nginx.tmpl: | ||
@curl -sS https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > $@ | ||
|
||
.PHONY: build | ||
build: | ||
@docker run \ | ||
--rm \ | ||
-v $(PWD):/usr/src/supersecret \ | ||
-w /usr/src/supersecret \ | ||
-v $(PWD):/go/$(PROJECT_PATH) \ | ||
-w /go/$(PROJECT_PATH) \ | ||
golang:$(GOLANG_VERSION) \ | ||
make bin/sup3rs3cretMes5age | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -f bin/* | ||
@docker-compose rm -fv | ||
|
||
run: clean build | ||
@docker-compose up --build | ||
run-local: clean build nginx.tmpl nginx/certs/default.crt | ||
@docker-compose up --build -d | ||
|
||
.PHONY: run | ||
run: clean build nginx.tmpl | ||
@docker-compose up --build -d | ||
|
||
.PHONY: stop | ||
stop: | ||
@docker-compose stop | ||
|
||
.PHONY: deps build clean run stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.