Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker operation mode #98

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Install conda dependencies
FROM mambaorg/micromamba:1.5.8
COPY --chown=$MAMBA_USER:$MAMBA_USER env.yaml /tmp/env.yaml
RUN micromamba install -y -n base -f /tmp/env.yaml && micromamba clean --all --yes
ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Set up transition repo
COPY --chown=$MAMBA_USER:$MAMBA_USER . lesson-transition
WORKDIR lesson-transition
RUN R -e 'options(renv.config.pak.enabled = TRUE); renv::restore()'

# This disables the interactive parts of the script
ENV CI=1 GITHUB_PAT=
# The .module-ignore seems to prevent certain lessons from being converted, so we truncate it
RUN > .module-ignore
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,34 @@ if there are no changes you wish to make
If your lesson is in a repository that does not belong to an official carpentries
account, you will need to append the `DIRS` varaible in the makefile.

### Docker

If you don't find it easy to get this project running, you might find the Docker version a bit easier, because it handles all necessary dependencies for you.
All you need to do is have Docker itself installed.

To perform a conversion using Docker, clone the repo, then:

```
# Build the container. This need only be done once
docker build . --tag lesson-transition
# Prepare the output directory
mkdir -m a=rwx output
# Perform the conversion
docker run \
--env GITHUB_PAT=ghp_XXX \
--env GITHUB_ACTOR=bot \
--volume ${PWD}/output:/tmp/lesson-transition/sandpaper \
lesson-transition \
make sandpaper/<ORG>/<REPO>.json
```

For example, for the `carpentries-incubator/docker-introduction` repo, this last line would be:
```
make sandpaper/carpentries-incubator/docker-introduction.json
```

Results will be in `output/<ORG>/<REPO>`, although you might have to `chown` them back to the correct user.

## Requirements

This repository has package management via {renv}, so there are two steps to
Expand Down Expand Up @@ -795,4 +823,3 @@ the pages need to be activated, which you can do via usethis:
library(usethis)
use_github_pages()
```

17 changes: 17 additions & 0 deletions env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: base
channels:
- conda-forge
dependencies:
- conda-forge::python
- conda-forge::r-base==4.3.2
- conda-forge::gh
- conda-forge::git
- conda-forge::pandoc==2.19.2
- conda-forge::libxml2
- conda-forge::libxslt
- conda-forge::freetype
- conda-forge::fontconfig
- conda-forge::pkg-config
- conda-forge::jq
- pip:
- git-filter-repo
6 changes: 3 additions & 3 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1133,14 +1133,14 @@
},
"xslt": {
"Package": "xslt",
"Version": "1.4.4",
"Version": "1.4.5",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "CRAN",
"Requirements": [
"Rcpp",
"xml2"
],
"Hash": "e2c9cc5c470a5a3a4c1d458404f1a034"
"Hash": "1ff6a2b18d8937ec8f39bb7c9385d2b8"
},
"yaml": {
"Package": "yaml",
Expand Down