Fu01978 commited on
Commit
b3e66ee
·
verified ·
1 Parent(s): 919e70c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -6
Dockerfile CHANGED
@@ -1,14 +1,21 @@
1
  FROM python:3.10-slim
2
 
3
- # Install Stockfish as root during build
4
  RUN apt-get update && apt-get install -y stockfish curl && rm -rf /var/lib/apt/lists/*
5
 
6
- WORKDIR /code
7
- COPY . .
 
 
 
 
 
 
 
 
 
8
  RUN pip install --no-cache-dir flask gunicorn chess
9
 
10
- # Ensure script is executable
11
  RUN chmod +x setup.sh
12
-
13
- # Set the entrypoint
14
  CMD ["./setup.sh"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install Stockfish as root
4
  RUN apt-get update && apt-get install -y stockfish curl && rm -rf /var/lib/apt/lists/*
5
 
6
+ # Create a non-root user and set up the working directory
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:/usr/games:$PATH
11
+
12
+ WORKDIR $HOME/app
13
+
14
+ # Copy files and ensure the 'user' owns them
15
+ COPY --chown=user . .
16
+
17
  RUN pip install --no-cache-dir flask gunicorn chess
18
 
19
+ # Explicitly find and export Stockfish path
20
  RUN chmod +x setup.sh
 
 
21
  CMD ["./setup.sh"]