jameshwade commited on
Commit
3f641c2
·
1 Parent(s): aa00b0e

rework dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -15
Dockerfile CHANGED
@@ -1,28 +1,30 @@
1
  FROM rocker/shiny-verse:latest
2
 
3
- # Create a non-root user to run the application
4
- RUN adduser --disabled-password --gecos "" appuser
5
 
6
- WORKDIR /code
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Install stable packages from CRAN
9
  RUN install2.r --error \
10
- shiny \
11
  bslib \
12
  httpuv \
13
  purrr \
14
- glue \
15
- httr2
16
-
17
- # Set the environment variable for the secret
18
- ENV OPENAI_API_KEY=${OPENAI_API_KEY}
19
-
20
- COPY . .
21
 
22
- # Change the ownership of the /code directory to appuser
23
- RUN chown -R appuser:appuser /code
24
 
25
- # Switch to the appuser user
26
- USER appuser
27
 
28
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
 
1
  FROM rocker/shiny-verse:latest
2
 
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN useradd -m -u 1000 user
5
 
6
+ # Switch to the "user" user
7
+ USER user
8
+
9
+ # Set home to the user's home directory
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH
12
+
13
+ # Set the working directory to the user's home directory
14
+ WORKDIR $HOME/app
15
+
16
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
17
+ COPY --chown=user . $HOME/app
18
 
19
  # Install stable packages from CRAN
20
  RUN install2.r --error \
 
21
  bslib \
22
  httpuv \
23
  purrr \
24
+ glue
 
 
 
 
 
 
25
 
26
+ RUN --mount=type=secret,id=SECRET_EXAMPLE,mode=0444,required=true
 
27
 
28
+ EXPOSE 7860
 
29
 
30
  CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]