-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (27 loc) · 885 Bytes
/
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
# The name of the Docker image
name := rstudio
# The directory to be mounted to the container
root ?= ${PWD}
all: start
# Create an alias for starting a new container and one for a shell prompt
alias:
@echo "alias ${name}='make -C \"${PWD}\" root=\"\$${PWD}\"'"
@echo "alias ${name}-shell='docker exec -it \$$(docker ps --format \"table {{.ID}}\" | tail -1) /bin/zsh'"
# Build a new image
build:
docker build --tag ${name} .
# Start a new container
start:
@echo 'Address: http://localhost:8787/'
@echo
@echo 'Press Control-C to terminate...'
@docker run --interactive --tty --rm \
--name ${name} \
--publish 8787:8787 \
--volume "${root}:/home/rstudio/$(shell basename ${root})" \
--env DISABLE_AUTH=true \
${name} > /dev/null
# Start a shell in a running container
shell:
@docker exec --interactive --tty ${name} /bin/bash
.PHONY: all alias build start shell