Spaces:
Runtime error
Runtime error
Commit
·
b57a5c0
1
Parent(s):
3e6cafa
add user to dockerfile
Browse files- Dockerfile +9 -6
- app.R +0 -2
Dockerfile
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
FROM rocker/shiny-verse:latest
|
2 |
|
|
|
|
|
|
|
3 |
WORKDIR /code
|
4 |
|
5 |
# Install stable packages from CRAN
|
@@ -13,10 +16,10 @@ RUN install2.r --error \
|
|
13 |
|
14 |
COPY . .
|
15 |
|
16 |
-
#
|
17 |
-
RUN
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
CMD ["
|
|
|
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
|
|
|
16 |
|
17 |
COPY . .
|
18 |
|
19 |
+
# Change the ownership of the /code directory to appuser
|
20 |
+
RUN chown -R appuser:appuser /code
|
21 |
+
|
22 |
+
# Switch to the appuser user
|
23 |
+
USER appuser
|
24 |
|
25 |
+
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
|
app.R
CHANGED
@@ -6,8 +6,6 @@ library(glue)
|
|
6 |
|
7 |
source("helper.R")
|
8 |
|
9 |
-
cat("API Key", Sys.getenv("OPENAI_API_KEY"))
|
10 |
-
|
11 |
ui <- page_sidebar(
|
12 |
title = "Chatbot with R & OpenAI",
|
13 |
theme = bs_theme(bootswatch = "vapor"),
|
|
|
6 |
|
7 |
source("helper.R")
|
8 |
|
|
|
|
|
9 |
ui <- page_sidebar(
|
10 |
title = "Chatbot with R & OpenAI",
|
11 |
theme = bs_theme(bootswatch = "vapor"),
|