Docker improvements, websocket support, CI/CD preparation

This commit is contained in:
administrator 2026-07-09 14:57:06 +05:30
parent f76fb9fac2
commit 54885316af
2 changed files with 109 additions and 15 deletions

View File

@ -2,15 +2,22 @@ FROM python:3.12-bookworm
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV LANG=C.UTF-8
ENV TZ=Asia/Kolkata
# ----------------------------------------------------
# System Dependencies
# ----------------------------------------------------
# System dependencies
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
g++ \
git \
curl \
wget \
npm \
tini \
libpq-dev \
libldap2-dev \
libsasl2-dev \
@ -21,34 +28,118 @@ RUN apt-get update && apt-get install -y \
libffi-dev \
libssl-dev \
liblcms2-dev \
libblas-dev \
libatlas-base-dev \
libyaml-dev \
libevent-dev \
fonts-dejavu \
wkhtmltopdf \
&& rm -rf /var/lib/apt/lists/*
# Less compiler used by Odoo
# ----------------------------------------------------
# LESS Compiler
# ----------------------------------------------------
RUN npm install -g less less-plugin-clean-css
# Create odoo user
RUN useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
# ----------------------------------------------------
# Create Odoo User
# ----------------------------------------------------
WORKDIR /opt/odoo/odoo18
RUN groupadd --system odoo && \
useradd \
--system \
--gid odoo \
--create-home \
--home-dir /opt/odoo \
--shell /bin/bash \
odoo
# ----------------------------------------------------
# Working Directory
# ----------------------------------------------------
WORKDIR /opt/odoo/source
# ----------------------------------------------------
# Python
# ----------------------------------------------------
RUN python -m pip install --upgrade \
pip \
setuptools \
wheel
# ----------------------------------------------------
# Copy Source
# ----------------------------------------------------
# Copy project
COPY . .
# Upgrade pip tools
RUN pip install --upgrade pip setuptools wheel
# ----------------------------------------------------
# Install Requirements
# ----------------------------------------------------
# Install requirements
RUN pip install --no-cache-dir -r requirements.txt
RUN if [ -f requirements.txt ]; then \
pip install --no-cache-dir -r requirements.txt ; \
fi
# PostgreSQL driver
RUN pip install psycopg2-binary
RUN pip install --no-cache-dir \
psycopg2-binary \
pip-tools
qifparse
pandas
pypdf
# Permissions
RUN chown -R odoo:odoo /opt/odoo
# ----------------------------------------------------
# Directories
# ----------------------------------------------------
RUN mkdir -p \
/var/lib/odoo \
/var/log/odoo \
/mnt/extra-addons
RUN chown -R odoo:odoo \
/opt/odoo \
/var/lib/odoo \
/var/log/odoo \
/mnt/extra-addons
RUN chmod -R 755 \
/var/lib/odoo \
/var/log/odoo
# ----------------------------------------------------
# Switch User
# ----------------------------------------------------
USER odoo
# ----------------------------------------------------
# Expose Port
# ----------------------------------------------------
EXPOSE 8069
CMD ["python3", "odoo-bin", "-c", "odoo.conf"]
# ----------------------------------------------------
# Health Check
# ----------------------------------------------------
#HEALTHCHECK --interval=30s \
# --timeout=10s \
# --start-period=60s \
# --retries=5 \
#CMD curl -fs http://127.0.0.1:8069/web/login || exit 1
# ----------------------------------------------------
# Init Process
# ----------------------------------------------------
ENTRYPOINT ["/usr/bin/tini","--"]
# ----------------------------------------------------
# Start Odoo
# ----------------------------------------------------
CMD ["python3", "odoo-bin", "-c", "/etc/odoo/odoo.conf"]

View File

@ -89,3 +89,6 @@ XlsxWriter==3.1.9 ; python_version >= '3.12'
xlwt==1.3.0
zeep==4.1.0 ; python_version < '3.11' # (jammy)
zeep==4.2.1 ; python_version >= '3.11'
qifparse
pandas
pypdf