File size: 2,483 Bytes
d6ed967
12cb92c
 
 
 
 
 
 
f96ea09
 
 
 
 
 
d330c36
f96ea09
32259a7
 
 
 
646142c
32259a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d330c36
 
8fe56ae
32259a7
 
8fe56ae
 
92858a7
d330c36
 
 
 
 
 
 
f96ea09
d330c36
f96ea09
4b733d9
d330c36
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
ARG GITHUB_PAT
ARG AMBHTMX_USER
ARG AMBHTMX_PASSWORD
ARG AMBHTMX_SECRET
ARG AMBHTMX_PROTOCOL
ARG AMBHTMX_HOST
ARG AMBHTMX_PORT

FROM rocker/r2u:22.04

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH

# Install system packages
RUN set -eux; \
        apt-get update; \
        apt-get install -y --no-install-recommends \
                git \
                sudo \
                sqlite3 \
                ca-certificates \
                gcc \
                libc6-dev \
                wget \
                && sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers \
                && sed -i -e '/^suppressMessages(bspm::enable())$/i options(bspm.sudo=TRUE)' /etc/R/Rprofile.site \
                ; \
        \
        url="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"; \
        wget "$url"; \
        chmod +x rustup-init; \
        ./rustup-init -y --no-modify-path --default-toolchain beta --default-host x86_64-unknown-linux-gnu; \
        rm rustup-init; \
        chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
        rustup --version; \
        cargo --version; \
        rustc --version; \
        \
        apt-get remove -y --auto-remove \
            wget \
            ; \
        rm -rf /var/lib/apt/lists/*;
        
# Install R packages
RUN install2.r --error -s --deps TRUE htmltools tibble dplyr purrr rlang glue this.path DBI pool RSQLite remotes promises assertthat log here zeallot dbplyr stringr tidyverse
RUN Rscript -e "install.packages('b64', repos = c('https://extendr.r-universe.dev', getOption('repos')))" 
RUN Rscript -e "install.packages('uwu', repos = c('https://josiahparry.r-universe.dev', getOption('repos')))" 
RUN --mount=type=secret,id=GITHUB_PAT GITHUB_PAT=$(cat /run/secrets/GITHUB_PAT) \
    installGithub.r devOpifex/ambiorix devOpifex/scilis devOpifex/signaculum jrosell/ambhtmx

# Prepare a user
RUN useradd --create-home --shell /bin/bash user
USER user
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user . $HOME/app

# Entry
EXPOSE 7860
CMD R -e "print(nchar(Sys.getenv('GITHUB_PAT'))); print(here::here()); (tmp_file <- tempfile()); print(tmp_file); writeLines('content', tmp_file); if (file.exists(tmp_file)) {unlink(tmp_file); print('Deleted')}; options('ambiorix.dbname'=paste0(tmp_file,'.sqlite')); print(getOption('ambiorix.dbname')); source('app.R'); "