-
Notifications
You must be signed in to change notification settings - Fork 888
/
Makefile
27 lines (21 loc) · 1.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
include .env
export
DOCKER_IMAGE=olympusdao/olympus-contracts
# Use the branch name as the tag
DOCKER_TAG=$(shell git branch --show-current)
DOCKER_VOLUMES=--volume $(shell pwd)/contracts:/opt/contracts/ --volume $(shell pwd)/scripts:/opt/scripts/
DOCKER_PORTS=-p 8545:8545
# Make sure any command using this variable is prepended by @ to hide it from the console & logs
DOCKER_ENV=-e ALCHEMY_API_KEY=$(ALCHEMY_API_KEY) -e PRIVATE_KEY=$(PRIVATE_KEY)
build:
docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) .
run: build
@docker run -it --rm $(DOCKER_ENV) $(DOCKER_VOLUMES) $(DOCKER_PORTS) $(DOCKER_IMAGE):$(DOCKER_TAG)
shell: build
@docker run -it --rm --entrypoint /bin/sh $(DOCKER_ENV) $(DOCKER_VOLUMES) $(DOCKER_PORTS) $(DOCKER_IMAGE):$(DOCKER_TAG)
_check_login_vars:
@test $${DOCKER_USER?Please set environment variable DOCKER_USER}
@test $${DOCKER_PASS?Please set environment variable DOCKER_PASS}
push: _check_login_vars build
@docker login -u "$(DOCKER_USER)" -p "$(DOCKER_PASS)"
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)