ariansyahdedy commited on
Commit
c13745d
·
1 Parent(s): 08e5dcd

remove user

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -21
Dockerfile CHANGED
@@ -12,33 +12,27 @@ ENV PATH="/root/.local/bin:$PATH"
12
  # Create a symlink so Poetry is accessible system-wide
13
  RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry
14
 
15
- # Set working directory
16
- WORKDIR /code
17
-
18
- # Copy Poetry files first to optimize Docker caching
19
- COPY pyproject.toml poetry.lock /code/
20
 
21
- # Install dependencies using Poetry
22
- RUN poetry install --no-root --no-interaction --no-ansi
23
 
24
- # Copy the rest of the project files
25
- COPY . /code
26
 
27
- # Ensure start script is executable
28
- RUN chmod +x /code/start.sh
29
 
30
- # Create necessary directories and set permissions before switching to non-root user
31
- RUN mkdir -p /code/uploaded_videos /code/output_frames \
32
- && chown -R 1000:1000 /code
33
 
34
- # # Switch to non-root user
35
- # USER 1000
36
 
37
- # Expose the application port
38
- EXPOSE 8000
39
 
40
- # Ensure logs are not buffered
41
- ENV PYTHONUNBUFFERED=1
42
 
43
- # Run the application using Poetry's virtual environment
44
  CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
12
  # Create a symlink so Poetry is accessible system-wide
13
  RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry
14
 
15
+ ## (Optional) If you want to keep 'USER' for final container usage,
16
+ # just do all installations as root FIRST, then switch user at the end.
17
+ # But for a simpler approach in Docker, you can remain root entirely.
 
 
18
 
19
+ FROM python:3.10
 
20
 
21
+ # Install Poetry
22
+ RUN curl -sSL https://install.python-poetry.org | python3 -
23
 
24
+ # Set Poetry in PATH
25
+ ENV PATH="/root/.local/bin:$PATH"
26
 
27
+ # Make sure script is executable (usually it already is, but just to be safe):
28
+ RUN chmod +x /root/.local/bin/poetry
 
29
 
30
+ WORKDIR /code
 
31
 
32
+ COPY pyproject.toml poetry.lock /code/
33
+ RUN poetry install --no-root --no-interaction --no-ansi
34
 
35
+ COPY . /code
 
36
 
37
+ EXPOSE 7860
38
  CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]