forked from jeffreybreen/docker-ubuntu18-blobfuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (67 loc) · 2.28 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# Makefile for Docker images by Jeffrey Breen <https://www.github.com/JeffreyBreen/>
#
# based on <https://www.itnotes.de/docker/development/tools/2014/08/31/speed-up-your-docker-workflow-with-a-makefile/>
#
#
## start by including any environment variables you need
# (but don't break if not present)
-include .env
# build-time:
REPO = docker.io
NS = jeffreybreen
IMAGE = ubuntu18-blobfuse
VERSION ?= latest
INSTANCE ?= default
# run-time:
PORTS ?=
VOLUMES ?=
#
## Pass Azure environment variables for blobfuse
#
# 1. Specify AZURE_STORAGE_ACCESS_KEY or AZURE_STORAGE_SAS_TOKEN -- not both
#
# 2. If the calling shell already has the proper environment variables set,
# uncomment the following lines to include their values automatically
ENV = \
-e AZURE_STORAGE_ACCOUNT \
-e AZURE_STORAGE_SAS_TOKEN \
-e AZURE_STORAGE_ACCOUNT_CONTAINER \
-e AZURE_MOUNT_POINT
# 3. If this Makefile is reading in the environment variables (e.g., via the
# above `include .env`), then you need to specify their values when you
# call `docker run`. CAUTION: This exposes their value on the command line.
#
# ENV = \
# -e AZURE_STORAGE_ACCOUNT="${AZURE_STORAGE_ACCOUNT}" \
# -e AZURE_STORAGE_SAS_TOKEN="${AZURE_STORAGE_SAS_TOKEN}" \
# -e AZURE_STORAGE_ACCOUNT_CONTAINER="${AZURE_STORAGE_ACCOUNT_CONTAINER}" \
# -e AZURE_MOUNT_POINT="${AZURE_MOUNT_POINT}"
#
# 4. The `--env-file` flag to `docker run` is a much better option for file-based storage of credentials
#
# ENV = --env_file /path/to/azure_secrets.env
#
#
## FUSE requires MKNOD and SYS_ADMIN privileges:
RUN_OPTS = \
--cap-add=MKNOD --cap-add=SYS_ADMIN \
--device=/dev/fuse
.PHONY: build push shell run start stop rm release
build:
docker build -t $(NS)/$(IMAGE):$(VERSION) .
push:
docker push $(REPO)/$(NS)/$(IMAGE):$(VERSION)
run:
docker run --rm --name $(IMAGE)-$(INSTANCE) $(PORTS) $(VOLUMES) $(ENV) $(RUN_OPTS) $(NS)/$(IMAGE):$(VERSION)
shell:
docker run --rm --name $(IMAGE)-$(INSTANCE) -i -t $(PORTS) $(VOLUMES) $(ENV) $(RUN_OPTS) $(NS)/$(IMAGE):$(VERSION) /bin/bash
start:
docker run -d --name $(IMAGE)-$(INSTANCE) $(PORTS) $(VOLUMES) $(ENV) $(RUN_OPTS) $(NS)/$(IMAGE):$(VERSION)
stop:
docker stop $(IMAGE)-$(INSTANCE)
rm:
docker rm $(IMAGE)-$(INSTANCE)
release: build
make push -e VERSION=$(VERSION)
default: build