jrosell commited on
Commit
d330c36
·
1 Parent(s): 32259a7

try a new Dockerfile

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. Dockerfile +21 -10
  3. Makefile +8 -2
  4. README.md +6 -0
.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  .Renviron
2
  *.sqlite
 
 
1
  .Renviron
2
  *.sqlite
3
+ build.log
Dockerfile CHANGED
@@ -1,12 +1,11 @@
1
  ARG GITHUB_PAT
2
  FROM rocker/r2u:22.04
3
 
4
- WORKDIR /workspace
5
-
6
  ENV RUSTUP_HOME=/usr/local/rustup \
7
  CARGO_HOME=/usr/local/cargo \
8
  PATH=/usr/local/cargo/bin:$PATH
9
 
 
10
  RUN set -eux; \
11
  apt-get update; \
12
  apt-get install -y --no-install-recommends \
@@ -34,19 +33,31 @@ RUN set -eux; \
34
  wget \
35
  ; \
36
  rm -rf /var/lib/apt/lists/*;
37
-
 
38
  RUN install2.r --error -s --deps TRUE \
39
- htmltools tidyverse zeallot rlang glue this.path DBI pool RSQLite remotes promises assertthat log
40
  RUN Rscript -e "install.packages('b64', repos = c('https://extendr.r-universe.dev', getOption('repos')))"
41
  RUN Rscript -e "install.packages('uwu', repos = c('https://josiahparry.r-universe.dev', getOption('repos')))"
42
  RUN installGithub.r \
43
- devOpifex/ambiorix devOpifex/scilis devOpifex/signaculum jrosell/ambhtmx
44
 
45
- # RUN adduser newuser
46
- # COPY --chown=newuser . .
47
 
48
- COPY . .
49
- RUN chmod -R 755 /workspace
 
 
 
 
 
50
 
 
51
  EXPOSE 7860
52
- CMD R -e "print(nchar(Sys.getenv('GITHUB_PAT'))); source('app.R'); "
 
 
 
 
 
 
 
 
1
  ARG GITHUB_PAT
2
  FROM rocker/r2u:22.04
3
 
 
 
4
  ENV RUSTUP_HOME=/usr/local/rustup \
5
  CARGO_HOME=/usr/local/cargo \
6
  PATH=/usr/local/cargo/bin:$PATH
7
 
8
+ # Install system packages
9
  RUN set -eux; \
10
  apt-get update; \
11
  apt-get install -y --no-install-recommends \
 
33
  wget \
34
  ; \
35
  rm -rf /var/lib/apt/lists/*;
36
+
37
+ # Install R packages
38
  RUN install2.r --error -s --deps TRUE \
39
+ htmltools tidyverse zeallot rlang glue this.path DBI pool RSQLite remotes promises assertthat log
40
  RUN Rscript -e "install.packages('b64', repos = c('https://extendr.r-universe.dev', getOption('repos')))"
41
  RUN Rscript -e "install.packages('uwu', repos = c('https://josiahparry.r-universe.dev', getOption('repos')))"
42
  RUN installGithub.r \
43
+ devOpifex/ambiorix devOpifex/scilis devOpifex/signaculum jrosell/ambhtmx
44
 
 
 
45
 
46
+ # Prepare a user
47
+ RUN useradd --create-home --shell /bin/bash user
48
+ USER user
49
+ ENV HOME=/home/user \
50
+ PATH=/home/user/.local/bin:$PATH
51
+ WORKDIR $HOME/app
52
+ COPY --chown=user . $HOME/app
53
 
54
+ # Entry
55
  EXPOSE 7860
56
+ CMD R -e "print(nchar(Sys.getenv('GITHUB_PAT'))); source('app.R'); "
57
+
58
+
59
+
60
+
61
+
62
+
63
+
Makefile CHANGED
@@ -8,7 +8,13 @@ all:
8
  && docker run --env-file=.Renviron -p 7860:7860 --name ambhtmx-container --rm ambhtmx-image \
9
  && echo "Done"
10
 
11
- stop:
12
  (docker container rm -f ambhtmx-container || true)\
13
  && (docker rmi $(docker images --format '{{.Repository}}:{{.ID}}'| egrep 'ambhtmx-image' | cut -d':' -f2 | uniq) --force || true) \
14
- && echo "Done"
 
 
 
 
 
 
 
8
  && docker run --env-file=.Renviron -p 7860:7860 --name ambhtmx-container --rm ambhtmx-image \
9
  && echo "Done"
10
 
11
+ clean:
12
  (docker container rm -f ambhtmx-container || true)\
13
  && (docker rmi $(docker images --format '{{.Repository}}:{{.ID}}'| egrep 'ambhtmx-image' | cut -d':' -f2 | uniq) --force || true) \
14
+ && echo "Done"
15
+
16
+ build:
17
+ docker build -f Dockerfile --no-cache --progress=plain -t ambhtmx-image . 2>&1 | tee build.log
18
+
19
+ run:
20
+ docker run --env-file=.Renviron -p 7860:7860 --name ambhtmx-container --rm ambhtmx-image
README.md CHANGED
@@ -58,4 +58,10 @@ docker rmi ID
58
 
59
  ## Troubleshooting
60
 
 
 
 
 
 
 
61
  Check the [known issues](https://github.com/jrosell/ambhtmx/issues), and if you have another issue? Please, [let me know](https://github.com/jrosell/ambhtmx/issues).
 
58
 
59
  ## Troubleshooting
60
 
61
+ If you want to see the logs:
62
+
63
+ ```
64
+ docker build -f Dockerfile --no-cache --progress=plain -t ambhtmx-image . 2>&1 | tee build.log
65
+ ```
66
+
67
  Check the [known issues](https://github.com/jrosell/ambhtmx/issues), and if you have another issue? Please, [let me know](https://github.com/jrosell/ambhtmx/issues).