Krishna Prakash commited on
Commit
d262af2
·
1 Parent(s): 98dac34

Fix Dockerfile to resolve build error

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -5
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- # Use official Python 3.2 image
2
- FROM python:3.2
3
 
4
  # Set working directory to /app (root of the repository)
5
  WORKDIR /app
@@ -13,9 +13,11 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
  # Copy the entire project
14
  COPY . /app
15
 
16
- # Create user if it doesn't exist, then switch to it and pre-create log file
17
- RUN id -u user &>/dev/null || useradd -m -u 1000 user
18
- RUN mkdir -p /home/user && touch /home/user/app.log && chown user:user /home/user/app.log
 
 
19
  USER user
20
  ENV HOME=/home/user \
21
  PATH=/home/user/.local/bin:$PATH
 
1
+ # Use official Python 3.9 image
2
+ FROM python:3.9
3
 
4
  # Set working directory to /app (root of the repository)
5
  WORKDIR /app
 
13
  # Copy the entire project
14
  COPY . /app
15
 
16
+ # Create user, directory, and log file with proper ownership in one step
17
+ RUN useradd -m -u 1000 user && \
18
+ mkdir -p /home/user && \
19
+ touch /home/user/app.log && \
20
+ chown user:user /home/user/app.log
21
  USER user
22
  ENV HOME=/home/user \
23
  PATH=/home/user/.local/bin:$PATH