Skip to content

Commit 6f38bb3

Browse files
committed
adding Docker setup
1 parent 497c35d commit 6f38bb3

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

.Rbuildignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
^\.github$
77
^\.git$
88
^cran-comments\.md$
9-
9+
^Makefile$

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Use the CRAN debian image as the base
2+
FROM --platform=linux/amd64 ghcr.io/r-devel/rcheckserver/debian:latest
3+
4+
# Set a working directory for the build
5+
WORKDIR /build
6+
7+
# Copy only the DESCRIPTION file first
8+
# This ensures R doesn't rebuild this layer unless dependencies change
9+
COPY DESCRIPTION .
10+
11+
# Install the system requirements and R dependencies
12+
RUN R -e 'install.packages(c("remotes", "rcmdcheck"), repos="https://cloud.r-project.org")' \
13+
&& R -e 'remotes::install_deps(dependencies = TRUE)'
14+
15+
# Clean up the build directory
16+
WORKDIR /workdir

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
IMAGE_NAME=bayesmallows-check-env
2+
PLATFORM=linux/amd64
3+
VOL=-v "$(shell pwd)":/workdir
4+
WORKDIR=-w /workdir
5+
6+
.PHONY: build-env check-debian shell clean
7+
8+
# 1. Build the environment (run this when DESCRIPTION changes)
9+
build-env:
10+
docker build --platform $(PLATFORM) -t $(IMAGE_NAME) .
11+
12+
# 2. Run the check (fast, uses cached dependencies)
13+
check-debian:
14+
docker run --rm $(VOL) $(WORKDIR) --platform $(PLATFORM) $(IMAGE_NAME) \
15+
bash -c "R CMD build . && R CMD check BayesMallowsSMC2_*.tar.gz"
16+
17+
# 3. Debugging shell
18+
shell:
19+
docker run --rm -it $(VOL) $(WORKDIR) --platform $(PLATFORM) $(IMAGE_NAME) /bin/bash
20+
21+
# 4. Clean up check artifacts
22+
clean:
23+
rm -rf *.Rcheck/
24+
rm -f *.tar.gz

0 commit comments

Comments
 (0)