jedick commited on
Commit
72d25de
·
1 Parent(s): c16c507

Move entrypoint.sh out of docker/ directory

Browse files
Dockerfile CHANGED
@@ -5,19 +5,19 @@ FROM rocker/r-ver:latest
5
  # Single RUN directive and two COPY directives
6
  # Pre-RUN COPY for relatively stable files, post-RUN COPY for app files
7
  # Avoid other directives like USER and ENV
8
- # entrypoint.sh activates the virtual environment for running the app
9
  # Considerations for remote development (HF Spaces Dev Mode)
10
  # Dev Mode requires useradd, chown and USER
11
  # Use CMD instead of ENTRYPOINT
12
 
13
  # Set working directory and copy non-app files
14
  WORKDIR /app
15
- COPY requirements.txt docker/entrypoint.sh .
16
 
17
  # Install Python and system tools
18
  # Create and activate virtual environment for installing packages
19
  # Install required Python and R packages
20
- # Make startup script executable
21
  # Add user with uid=1000 and chown /app directory for HF Spaces Dev Mode
22
  RUN apt-get update && \
23
  apt-get install -y python3 python3-pip python3-venv screen vim git && \
@@ -27,17 +27,18 @@ RUN apt-get update && \
27
  export PATH="/opt/venv/bin:$PATH" && \
28
  pip --no-cache-dir install -r requirements.txt && \
29
  R -q -e 'install.packages(c("ellmer", "mcptools", "readr", "ggplot2", "tidyverse"))' && \
30
- chmod +x entrypoint.sh && \
 
31
  useradd -m -u 1000 user && \
32
  chown -R user /app
33
 
34
  # Copy app files with user permissions
35
- # NOTE: because the repo has docker/entrypoint.sh, this does *not*
36
- # overwrite the entrypoint.sh that we made executable above
37
  COPY --chown=user . /app
38
 
39
  # Set the user for Dev Mode
40
  USER user
41
 
42
  # Set default command (executable file in WORKDIR)
43
- CMD [ "/app/entrypoint.sh" ]
 
5
  # Single RUN directive and two COPY directives
6
  # Pre-RUN COPY for relatively stable files, post-RUN COPY for app files
7
  # Avoid other directives like USER and ENV
8
+ # startup.sh activates the virtual environment for running the app
9
  # Considerations for remote development (HF Spaces Dev Mode)
10
  # Dev Mode requires useradd, chown and USER
11
  # Use CMD instead of ENTRYPOINT
12
 
13
  # Set working directory and copy non-app files
14
  WORKDIR /app
15
+ COPY requirements.txt entrypoint.sh .
16
 
17
  # Install Python and system tools
18
  # Create and activate virtual environment for installing packages
19
  # Install required Python and R packages
20
+ # Rename startup script and make it executable
21
  # Add user with uid=1000 and chown /app directory for HF Spaces Dev Mode
22
  RUN apt-get update && \
23
  apt-get install -y python3 python3-pip python3-venv screen vim git && \
 
27
  export PATH="/opt/venv/bin:$PATH" && \
28
  pip --no-cache-dir install -r requirements.txt && \
29
  R -q -e 'install.packages(c("ellmer", "mcptools", "readr", "ggplot2", "tidyverse"))' && \
30
+ cp entrypoint.sh startup.sh && \
31
+ chmod +x startup.sh && \
32
  useradd -m -u 1000 user && \
33
  chown -R user /app
34
 
35
  # Copy app files with user permissions
36
+ # NOTE: This overwrites all copied files, rendering them non-executable. That is why we
37
+ # created an executable file with a different name (startup.sh) that is not overwritten here.
38
  COPY --chown=user . /app
39
 
40
  # Set the user for Dev Mode
41
  USER user
42
 
43
  # Set default command (executable file in WORKDIR)
44
+ CMD [ "/app/startup.sh" ]
docker/entrypoint.sh → entrypoint.sh RENAMED
File without changes