-
Notifications
You must be signed in to change notification settings - Fork 142
/
Makefile
59 lines (47 loc) · 1.82 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
DEBIAN_DOCKERFILE = Dockerfile
DEBIAN_TAG = rcloud-simple
DOCKER_TARGET = runtime-simple
HOST_PORT = 8080
CONTAINER_PORT = 8080
BUILD_JOBS = 16
help:
@echo "This Makefile provides access and a reference to docker-related commands."
build:
@echo "Building..."
docker buildx build --build-arg BUILD_JOBS=$(BUILD_JOBS) -f $(DEBIAN_DOCKERFILE) --target $(DOCKER_TARGET) -t $(DEBIAN_TAG) .
build-no-cache:
@echo "Building with --no-cache..."
docker buildx build --no-cache --build-arg BUILD_JOBS=$(BUILD_JOBS) -f $(DEBIAN_DOCKERFILE) --target $(DOCKER_TARGET) -t $(DEBIAN_TAG) .
run:
@echo "Running ephemeral container..."
docker run -it --rm -p $(HOST_PORT):$(CONTAINER_PORT) \
--mount source=rcloud-run,target=/rcloud-run \
--mount source=rcloud-data,target=/rcloud-data \
--add-host=redis:127.0.0.1 $(DEBIAN_TAG)
dev:
@echo "Building dev container..."
docker buildx build --build-arg BUILD_JOBS=$(BUILD_JOBS) -f $(DEBIAN_DOCKERFILE) --target dev -t runtime-dev .
@echo "Starting dev container..."
docker run -it --rm -p $(HOST_PORT):$(CONTAINER_PORT) \
-v "`pwd`:/src" \
--mount source=rcloud-run,target=/rcloud-run \
--mount source=rcloud-data,target=/rcloud-data \
--add-host=redis:127.0.0.1 --entrypoint /bin/bash runtime-dev
create:
@echo "Creating container..."
docker create -p $(HOST_PORT):$(CONTAINER_PORT) --name $(DEBIAN_TAG) $(DEBIAN_TAG)
destroy:
@echo "DRY RUN: To destroy the container, run 'make destroy-no-dry-run'"
destroy-no-dry-run:
@echo "Destroying container..."
docker container rm $(DEBIAN_TAG)
start:
@echo "Starting container..."
docker start $(DEBIAN_TAG)
stop:
@echo "Stopping container..."
docker stop $(DEBIAN_TAG)
bash:
@echo "Connecting to running container..."
docker exec -it $(DEBIAN_TAG) bash
.PHONY: bash build create destroy destroy-no-dry-run help run start stop