mikmc commited on
Commit
729f0ef
·
verified ·
1 Parent(s): 7c4871b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -6,13 +6,12 @@ LABEL name="Comet" \
6
 
7
  RUN addgroup -S myuser && adduser -S myuser -G myuser
8
 
9
- # Set working directory
10
  WORKDIR /app
11
 
12
- # Copy the necessary files first for caching
13
  COPY poetry.lock pyproject.toml ./
14
 
15
- # Set environment variables for Poetry
16
  ENV PYTHONUNBUFFERED=1 \
17
  PYTHONDONTWRITEBYTECODE=1 \
18
  POETRY_NO_INTERACTION=1 \
@@ -21,26 +20,27 @@ ENV PYTHONUNBUFFERED=1 \
21
  TERM=xterm-256color \
22
  POETRY_CACHE_DIR="/home/myuser/.cache/pypoetry"
23
 
24
- # Install necessary packages
25
  RUN apk add --no-cache gcc musl-dev libffi-dev make
26
 
27
- # Prepare cache directory
28
  RUN mkdir -p /home/myuser/.cache/pypoetry && \
29
  chown -R myuser:myuser /home/myuser/.cache/pypoetry
30
 
31
  # Install Poetry
32
  RUN pip install poetry
33
 
34
- # Change ownership of the /app directory
 
 
 
35
  RUN chown -R myuser:myuser /app
36
 
 
37
  USER myuser
38
 
39
- # Copy the rest of your application code
40
- COPY --chown=myuser:myuser . .
41
-
42
- # Install dependencies
43
  RUN poetry install --no-cache --no-root --without dev
44
 
45
- # Set entry point
46
  ENTRYPOINT ["poetry", "run", "python", "-m", "comet.main"]
 
6
 
7
  RUN addgroup -S myuser && adduser -S myuser -G myuser
8
 
 
9
  WORKDIR /app
10
 
11
+ # Copying only the build files first
12
  COPY poetry.lock pyproject.toml ./
13
 
14
+ # Environment variables for Poetry setup
15
  ENV PYTHONUNBUFFERED=1 \
16
  PYTHONDONTWRITEBYTECODE=1 \
17
  POETRY_NO_INTERACTION=1 \
 
20
  TERM=xterm-256color \
21
  POETRY_CACHE_DIR="/home/myuser/.cache/pypoetry"
22
 
23
+ # Install dependencies
24
  RUN apk add --no-cache gcc musl-dev libffi-dev make
25
 
26
+ # Create cache directory for Poetry
27
  RUN mkdir -p /home/myuser/.cache/pypoetry && \
28
  chown -R myuser:myuser /home/myuser/.cache/pypoetry
29
 
30
  # Install Poetry
31
  RUN pip install poetry
32
 
33
+ # Copy the application code
34
+ COPY --chown=myuser:myuser . .
35
+
36
+ # Change the owner of the /app directory just in case
37
  RUN chown -R myuser:myuser /app
38
 
39
+ # Switch to the non-root user
40
  USER myuser
41
 
42
+ # Now install dependencies
 
 
 
43
  RUN poetry install --no-cache --no-root --without dev
44
 
45
+ # Set entry point of the application
46
  ENTRYPOINT ["poetry", "run", "python", "-m", "comet.main"]