chore: improve docker-compose setup

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-01-14 16:32:01 +01:00
parent 0e1bc202c6
commit 48d78ec0ab
No known key found for this signature in database
GPG key ID: 34CC109EB5ED1C2A
4 changed files with 27 additions and 6 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/.idea/ /.idea/
/bin/ /bin/
/docker-compose.override.yaml
/vendor/ /vendor/

View file

@ -40,6 +40,18 @@ bin/example-app:
release-binary: release-binary:
@go build -o /go/bin/dex -v -ldflags $(LD_FLAGS) $(REPO_PATH)/cmd/dex @go build -o /go/bin/dex -v -ldflags $(LD_FLAGS) $(REPO_PATH)/cmd/dex
docker-compose.override.yaml:
cp docker-compose.override.yaml.dist docker-compose.override.yaml
.PHONY: up
up: docker-compose.override.yaml ## Launch the development environment
@ if [ docker-compose.override.yaml -ot docker-compose.override.yaml.dist ]; then diff -u docker-compose.override.yaml docker-compose.override.yaml.dist || (echo "!!! The distributed docker-compose.override.yaml example changed. Please update your file accordingly (or at least touch it). !!!" && false); fi
docker-compose up -d
.PHONY: down
down: clear ## Destroy the development environment
docker-compose down --volumes --remove-orphans --rmi local
test: bin/test/kube-apiserver bin/test/etcd test: bin/test/kube-apiserver bin/test/etcd
@go test -v ./... @go test -v ./...

View file

@ -0,0 +1,14 @@
version: "3.8"
services:
mysql:
ports:
- "127.0.0.1:3306:3306"
postgres:
ports:
- "127.0.0.1:5432:5432"
etcd:
ports:
- "127.0.0.1:2379:2379"

View file

@ -16,8 +16,6 @@ services:
MYSQL_USER: mysql MYSQL_USER: mysql
MYSQL_PASSWORD: mysql MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
ports:
- "127.0.0.1:3306:3306"
postgres: postgres:
image: postgres:10.15 image: postgres:10.15
@ -25,16 +23,12 @@ services:
POSTGRES_DB: dex POSTGRES_DB: dex
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
ports:
- "127.0.0.1:5432:5432"
etcd: etcd:
image: gcr.io/etcd-development/etcd:v3.4.9 image: gcr.io/etcd-development/etcd:v3.4.9
environment: environment:
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379 ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379 ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
ports:
- "127.0.0.1:2379:2379"
# For testing the Kubernetes storage backend we suggest https://kind.sigs.k8s.io/: # For testing the Kubernetes storage backend we suggest https://kind.sigs.k8s.io/:
# kind create cluster # kind create cluster