Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (33 sloc) 1009 Bytes
# 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
You can’t perform that action at this time.