-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (30 loc) · 954 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
# User-defined variables
DOCKER_USER := alexenge
IMAGE_VERSION := latest
# Automatic workflow variables
PROJECT_DIR := $(CURDIR)
PROJECT_NAME := $(notdir $(CURDIR))
IMAGE_TAG := $(DOCKER_USER)/$(PROJECT_NAME)
REMOTE_DIR := /home/rstudio/project
SHELL := bash
# If DOCKER=TRUE, do stuff inside the Docker container
ifeq ($(DOCKER), TRUE)
run := docker run --rm --volume $(PROJECT_DIR):$(REMOTE_DIR) $(IMAGE_TAG)
endif
# Knit the slides
all: slides/slides.pdf
slides/slides.pdf:
$(run) Rscript -e "rmarkdown::render(input = 'slides.Rmd')"
# Run an interactive RStudio session with Docker
interactive:
docker run --rm --volume $(PROJECT_DIR):$(REMOTE_DIR) \
-e PASSWORD=1234 -p 8888:8888 $(IMAGE_TAG)
# Build the container with Docker
build: Dockerfile
docker build --no-cache --progress plain --tag $(IMAGE_TAG) .
# Push the container with Docker
push:
docker push $(IMAGE_TAG)
# Pull the container with Docker
pull:
docker pull $(IMAGE_TAG)