File size: 845 Bytes
9943a73
c2eb8a0
a98df3d
9943a73
c2eb8a0
a98df3d
9943a73
 
c2eb8a0
a98df3d
9943a73
 
a98df3d
9943a73
c2eb8a0
a98df3d
 
 
 
9943a73
 
a98df3d
 
b64ba77
a98df3d
 
 
 
9943a73
b64ba77
a98df3d
 
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
FROM python:3.10

# Create a new user "user" with user ID 1000
RUN useradd -m -u 1000 user

# Set environment variables for the user's home and PATH
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory
WORKDIR $HOME/app

# Copy the application code and set the owner to "user"
COPY --chown=user . $HOME/app

# Switch to root to install dependencies and adjust permissions
USER root

# Install Python dependencies
RUN pip3 install -r requirements.txt

# Create the exports/charts directory (if not already present) and update its permissions
RUN mkdir -p $HOME/app/exports/charts && chmod -R 777 $HOME/app/exports/charts

# (Optional) Update permissions for the entire app directory if needed
RUN chmod -R 777 $HOME/app

# Switch back to the "user"
USER user

# Command to run the app
CMD ["python", "main.py"]