Azeez98 commited on
Commit
ea4ba11
·
verified ·
1 Parent(s): f653b8b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -64
Dockerfile CHANGED
@@ -1,43 +1,60 @@
1
- FROM ubuntu:jammy
2
 
3
  SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
4
 
5
- # Generate locale C.UTF-8 for postgres and general locale data
6
  ENV LANG en_US.UTF-8
7
 
8
- # Retrieve the target architecture to install the correct wkhtmltopdf package
9
  ARG TARGETARCH
10
 
11
- # Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
12
-
13
  RUN apt-get update && \
14
  DEBIAN_FRONTEND=noninteractive \
15
  apt-get install -y --no-install-recommends \
 
16
  ca-certificates \
17
  curl \
18
  dirmngr \
19
  fonts-noto-cjk \
20
  gnupg \
21
  libssl-dev \
22
- node-less \
23
- npm \
24
- python3-magic \
25
- python3-num2words \
26
- python3-odf \
27
- python3-pdfminer \
28
- python3-pip \
29
- python3-phonenumbers \
30
- python3-pyldap \
31
- python3-qrcode \
32
- python3-renderpm \
33
- python3-setuptools \
34
- python3-slugify \
35
- python3-vobject \
36
  python3-watchdog \
37
  python3-xlrd \
38
  python3-xlwt \
39
- xz-utils && \
40
- if [ -z "${TARGETARCH}" ]; then \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  TARGETARCH="$(dpkg --print-architecture)"; \
42
  fi; \
43
  WKHTMLTOPDF_ARCH=${TARGETARCH} && \
@@ -50,8 +67,7 @@ RUN apt-get update && \
50
  && echo ${WKHTMLTOPDF_SHA} wkhtmltox.deb | sha1sum -c - \
51
  && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
52
  && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
53
-
54
- # install latest postgresql-client
55
  RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
56
  && GNUPGHOME="$(mktemp -d)" \
57
  && export GNUPGHOME \
@@ -64,44 +80,3 @@ RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' > /etc/a
64
  && apt-get install --no-install-recommends -y postgresql-client \
65
  && rm -f /etc/apt/sources.list.d/pgdg.list \
66
  && rm -rf /var/lib/apt/lists/*
67
-
68
- # Set up Python environment
69
- WORKDIR /install
70
- COPY requirements.txt ./
71
-
72
- # Upgrade pip and setuptools
73
- RUN pip install --upgrade pip setuptools wheel
74
-
75
- # Install Python dependencies
76
- RUN pip install --no-cache-dir --prefix=/install -r ./requirements.txt
77
-
78
- # Final Stage: Offline Mode
79
- FROM python:3.9-slim as runtime
80
-
81
- # Copy installed dependencies from the builder stage
82
- COPY --from=builder /usr/local /usr/local
83
- COPY --from=builder /usr/bin /usr/bin
84
- COPY --from=builder /usr/sbin /usr/sbin
85
- COPY --from=builder /lib /lib
86
- COPY --from=builder /etc/ssl /etc/ssl
87
- COPY --from=builder /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
88
- COPY --from=builder /usr/share/fonts /usr/share/fonts
89
- COPY --from=builder /etc/fonts /etc/fonts
90
-
91
- # Optional: Copy application files and set up environment
92
- # COPY docker-entrypoint.sh /
93
- # COPY docker-cmd.sh /
94
- # COPY your_project_directory /usr/src/app
95
-
96
- # Optional: User setup and permissions
97
- # RUN chmod +x /docker-entrypoint.sh /docker-cmd.sh && \
98
- # useradd -m -s /bin/sh -u 1001 myuser
99
-
100
- # Set working directory
101
- WORKDIR /usr/src/app
102
-
103
- # Set entrypoint and command
104
- # ENTRYPOINT ["/docker-entrypoint.sh"]
105
- # CMD ["/docker-cmd.sh"]
106
-
107
- EXPOSE 8000
 
1
+ ROM ubuntu:jammy as builder
2
 
3
  SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
4
 
 
5
  ENV LANG en_US.UTF-8
6
 
 
7
  ARG TARGETARCH
8
 
9
+ # Install dependencies
 
10
  RUN apt-get update && \
11
  DEBIAN_FRONTEND=noninteractive \
12
  apt-get install -y --no-install-recommends \
13
+ python3-pip \
14
  ca-certificates \
15
  curl \
16
  dirmngr \
17
  fonts-noto-cjk \
18
  gnupg \
19
  libssl-dev \
20
+ libjpeg-turbo8 \
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  python3-watchdog \
22
  python3-xlrd \
23
  python3-xlwt \
24
+ xz-utils \
25
+ xfonts-base \
26
+ xfonts-75dpi \
27
+ libxrender1 \
28
+ libfontconfig1 \
29
+ libpng16-16 \
30
+ libx11-6 \
31
+ libxcb1 \
32
+ libxext6 \
33
+ libx11-xcb1 \
34
+ libxcomposite1 \
35
+ libxcursor1 \
36
+ libxdamage1 \
37
+ libxi6 \
38
+ libxrandr2 \
39
+ libxtst6 \
40
+ libglib2.0-0 \
41
+ libxfixes3 \
42
+ libxinerama1 \
43
+ libxss1 \
44
+ fontconfig \
45
+ build-essential \
46
+ python3-dev \
47
+ libjpeg-dev \
48
+ zlib1g-dev \
49
+ libpq-dev \
50
+ libxml2-dev \
51
+ libxslt1-dev \
52
+ libffi-dev \
53
+ gosu \
54
+ && rm -rf /var/lib/apt/lists/*
55
+
56
+ # Install wkhtmltopdf
57
+ RUN if [ -z "${TARGETARCH}" ]; then \
58
  TARGETARCH="$(dpkg --print-architecture)"; \
59
  fi; \
60
  WKHTMLTOPDF_ARCH=${TARGETARCH} && \
 
67
  && echo ${WKHTMLTOPDF_SHA} wkhtmltox.deb | sha1sum -c - \
68
  && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
69
  && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
70
+ # Install latest postgresql-client
 
71
  RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
72
  && GNUPGHOME="$(mktemp -d)" \
73
  && export GNUPGHOME \
 
80
  && apt-get install --no-install-recommends -y postgresql-client \
81
  && rm -f /etc/apt/sources.list.d/pgdg.list \
82
  && rm -rf /var/lib/apt/lists/*