Shubham Krishna commited on
Commit
730387b
1 Parent(s): 5a93871

Add permission according to Docs

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -5
Dockerfile CHANGED
@@ -4,7 +4,6 @@ WORKDIR /code
4
 
5
  # install poetry
6
  RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.2 python3 -
7
- ENV PATH="${PATH}:/root/.local/bin"
8
 
9
  # copy poetry configs and lock file
10
  COPY pyproject.toml poetry.lock ./
@@ -12,12 +11,21 @@ COPY pyproject.toml poetry.lock ./
12
  # Install dependencies
13
  RUN poetry config virtualenvs.create false && poetry install --no-root --no-interaction
14
 
15
- # copy project
16
- COPY . .
 
 
 
 
 
17
 
18
- EXPOSE 7860
 
 
 
 
19
 
20
- RUN chmod 777 /hello_world
21
 
22
  CMD ["python", "./hello_world/app.py"]
23
 
 
4
 
5
  # install poetry
6
  RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.2 python3 -
 
7
 
8
  # copy poetry configs and lock file
9
  COPY pyproject.toml poetry.lock ./
 
11
  # Install dependencies
12
  RUN poetry config virtualenvs.create false && poetry install --no-root --no-interaction
13
 
14
+ # Set up a new user named "user" with user ID 1000
15
+ RUN useradd -m -u 1000 user
16
+ # Switch to the "user" user
17
+ USER user
18
+ # Set home to the user's home directory
19
+ ENV HOME=/home/user \
20
+ PATH=/home/user/.local/bin:$PATH
21
 
22
+ # Set the working directory to the user's home directory
23
+ WORKDIR $HOME/app
24
+
25
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
26
+ COPY --chown=user . $HOME/app
27
 
28
+ EXPOSE 7860
29
 
30
  CMD ["python", "./hello_world/app.py"]
31