SocialChangeLab / media-impact-monitor

The Media Impact Monitor will be a novel tool for protest groups and NGOs to measure and visualize their impact on public discourse.
https://mediaimpactmonitor.app
Other
37 stars 1 forks source link

add devcontainer #1

Closed kleinlennart closed 8 months ago

kleinlennart commented 9 months ago

@davidpomerenke's recommended Python environment:

@kleinlennart likes to use a custom R container based on rocker:

@vogelino needs?

kleinlennart commented 9 months ago

Added R devcontainer bdb650aa2e9a41870ec86c71375ba5196cc210cb

kleinlennart commented 9 months ago

@davidpomerenke's wishlist:

kleinlennart commented 9 months ago

Use ubuntu:jammy as base image?

davidpomerenke commented 9 months ago

I've set up all Python stuff and some extensions and settings in https://github.com/SocialChangeLab/media-impact-monitor/commit/8137a4c3937182d04d60683afb8c129d1fc14ad4

However for setting up a custom Dockerfile, I had to remove the reference to the original Dockerfile (ghcr.io/rocker-org/devcontainer/tidyverse:4.3) I'm not sure how we would best bring its functionality back. I looked up the source of that image and traced it back a few steps, and what it essentially does is execute these two scripts:

For the first one of these, there is also an alternative script: https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_R_ppa.sh

We could probably simplify this by just using the official installation instructions: https://cran.r-project.org/bin/linux/ubuntu/fullREADME.html

Or maybe there is some devcontainer-feature that installs R itself?

kleinlennart commented 9 months ago

Nice! Don't worry about the rocker image, I will get it to work again. Probably nicer to have a lightweight R installation anyways. Most R packages can be installed via apt-get on Ubuntu and there is also a devcontainer-feature for it that automatically installs all system dependencies as well. Probably improves container build times if I add this to the devcontainer and not the Dockerfile so we don't have to do a Full Rebuild for every new R package. But I will probably use renv for dependency management anyway.

kleinlennart commented 9 months ago

Is there a specific reason why you added the Dockerfile to the main folder instead of .devontainer?

davidpomerenke commented 9 months ago

No reason, I changed it now 👍 https://github.com/SocialChangeLab/media-impact-monitor/commit/318f61f8a492001a6e989721adb91205ed7f5408

kleinlennart commented 9 months ago

Currently testing a dockerfile with the rocker install scripts (the devcontainer feature didn't do a good job setting up all the ENV variables for R). However, the container build takes a loong time now :(

davidpomerenke commented 9 months ago

Yeah ... did it use to be better with the previous setup?

That setup probably used a pre-built container, and then the devcontainer-features ran some minor additions on top of that basis; whereas now all the stuff might be run from scratch ...

davidpomerenke commented 8 months ago

I've setup everything using devcontainer-features again.

The only thing that does not work is installing packages like this:

"ghcr.io/rocker-org/devcontainer-features/r-packages:1": {
    "packages": [
        "easystats"
    ],
    "installSystemRequirements": true
},

This gives some (package-specific?) error. I'll make a separate issue for that.

Can you check whether the Devcontainer works for you, and whether you're missing anything? @kleinlennart @vogelino

davidpomerenke commented 8 months ago

Issue for the R packages problem: #9

kleinlennart commented 8 months ago

Closed with #19