-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (33 loc) · 1009 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
34
35
36
37
38
39
40
41
# The name of the Docker image
name := rstudio
# The directory to be mounted to the container
root ?= ${PWD}
this := $(shell dirname $(realpath $(lastword ${MAKEFILE_LIST})))
all: start
# Create an alias for starting a new container
alias:
echo "alias ${name}='make -C \"${PWD}\" root=\"\$${PWD}\"'" >> ~/.$(if ${ZSH_NAME},bash,zsh)rc
# Build a new image
build:
docker rmi ${name} || true
docker build --tag ${name} .
# Start a new container
start: ${root}/.rstudio
@echo "Address: http://localhost:8787/"
@echo "User: rstudio"
@echo "Password: rstud10"
@echo
@echo 'Press Control-C to terminate...'
@docker run --interactive --tty --rm \
--name ${name} \
--publish 8787:8787 \
--volume "${root}:/home/rstudio" \
--env PASSWORD=rstud10 \
${name} > /dev/null
# Start a shell in a running container
shell:
@docker exec --interactive --tty ${name} /bin/bash
# Copy user preferences upon start
${root}/.rstudio:
@cp -R "${this}/.rstudio" "$@"
.PHONY: all alias build start shell