sanjay7178 commited on
Commit
f7cd48e
·
verified ·
1 Parent(s): ecbaf7a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -30
Dockerfile CHANGED
@@ -1,52 +1,49 @@
 
1
  FROM python:3.9-slim-buster
2
 
3
  # Create a new user and set permissions
4
  RUN useradd -m -u 1000 user
5
 
6
- # Install required system packages using apt-get
7
- RUN apt-get update && apt-get install -y \
8
  curl \
9
  python3-pip \
10
  build-essential \
11
  libssl-dev \
12
  libffi-dev \
13
  cargo \
14
- python3-pypdf2 \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
 
17
  ENV OPENCV_VERSION="4.10.0"
18
 
19
- RUN apt-get update && apt-get install -y python3-opencv
20
- RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
21
-
22
- RUN apt-get -qq install -y --no-install-recommends \
23
- build-essential \
24
- cmake \
25
- git \
26
- wget \
27
- unzip \
28
- yasm \
29
- pkg-config \
30
- libswscale-dev \
31
- libtbb2 \
32
- libtbb-dev \
33
- libjpeg-dev \
34
- libpng-dev \
35
- libtiff-dev \
36
- libopenjp2-7-dev \
37
- libavformat-dev \
38
- libpq-dev
39
-
40
-
41
-
42
- COPY ./requirements.txt .
43
- RUN pip install --no-cache -r requirements.txt
44
-
45
  # Set the working directory
46
  WORKDIR /app
47
 
 
 
 
48
 
49
- # Copy the application code to the working directory
50
  COPY --chown=user . /app
51
 
52
  # Expose the port the app runs on
 
1
+ # Use a minimal Python image
2
  FROM python:3.9-slim-buster
3
 
4
  # Create a new user and set permissions
5
  RUN useradd -m -u 1000 user
6
 
7
+ # Install required system packages and clean up in a single layer to reduce image size
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
  curl \
10
  python3-pip \
11
  build-essential \
12
  libssl-dev \
13
  libffi-dev \
14
  cargo \
15
+ python3-opencv \
16
+ ffmpeg \
17
+ libsm6 \
18
+ libxext6 \
19
+ cmake \
20
+ git \
21
+ wget \
22
+ unzip \
23
+ yasm \
24
+ pkg-config \
25
+ libswscale-dev \
26
+ libtbb2 \
27
+ libtbb-dev \
28
+ libjpeg-dev \
29
+ libpng-dev \
30
+ libtiff-dev \
31
+ libopenjp2-7-dev \
32
+ libavformat-dev \
33
+ libpq-dev \
34
  && rm -rf /var/lib/apt/lists/*
35
 
36
+ # Set the OpenCV version environment variable
37
  ENV OPENCV_VERSION="4.10.0"
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  # Set the working directory
40
  WORKDIR /app
41
 
42
+ # Copy the requirements and install dependencies
43
+ COPY ./requirements.txt .
44
+ RUN pip install --no-cache-dir -r requirements.txt
45
 
46
+ # Copy the application code to the working directory with the correct permissions
47
  COPY --chown=user . /app
48
 
49
  # Expose the port the app runs on