Skip to content

Instantly share code, notes, and snippets.

@tuanle96
Created March 27, 2025 15:12
Show Gist options
  • Save tuanle96/7a369a71ce96aabb34bfd7d37e33a97b to your computer and use it in GitHub Desktop.
Save tuanle96/7a369a71ce96aabb34bfd7d37e33a97b to your computer and use it in GitHub Desktop.
Odoo 18 Dockerfile
FROM debian:bookworm-slim
SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
# Không sử dụng ARG cho dữ liệu nhạy cảm (sẽ sử dụng biến môi trường khi build nếu cần)
ARG GIT_ORG=earnbaseio
ARG GIT_REPO=odoo
ARG GIT_REGISTRY=github.com
ARG TARGETARCH=
# Generate locale C.UTF-8 for postgres and general locale data
ENV LANG=C.UTF-8 \
ODOO_VERSION=18.0 \
ODOO_USER=odoo \
ODOO_HOME=/opt/odoo \
ODOO_RC=/etc/odoo/odoo.conf
# Create the Odoo user and directory
RUN adduser --system --group --home $ODOO_HOME --uid 1000 $ODOO_USER && \
mkdir -p $ODOO_HOME/odoo-addons && \
mkdir $ODOO_HOME/odoo-data && \
mkdir /mnt/extra-addons && \
mkdir -p /etc/odoo && \
chown -R $ODOO_USER:$ODOO_USER $ODOO_HOME
# Install all dependencies in a single layer
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dirmngr \
fonts-noto-cjk \
gnupg \
libssl-dev \
node-less \
npm \
python3-num2words \
python3-pdfminer \
python3-pip \
python3-phonenumbers \
python3-pyldap \
python3-qrcode \
python3-renderpm \
python3-setuptools \
python3-slugify \
python3-vobject \
python3-watchdog \
python3-xlrd \
python3-xlwt \
xz-utils \
libsasl2-dev \
libldap2-dev \
libffi-dev \
build-essential \
python3-dev \
wget \
git \
vim \
libmagic1 \
libcairo2-dev \
libglib2.0-dev \
libpq-dev \
zlib1g-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libreadline-dev \
libsqlite3-dev \
libbz2-dev \
postgresql-client \
postgresql-client-common \
screen \
libzbar-dev && \
rm -rf /var/lib/apt/lists/* && \
npm install -g rtlcss && \
rm /usr/lib/python3.11/EXTERNALLY-MANAGED && \
# Install wkhtmltopdf
curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \
apt-get update && \
apt-get install -y --no-install-recommends ./wkhtmltox.deb && \
rm -rf /var/lib/apt/lists/* wkhtmltox.deb
ENV PATH="/opt/odoo/.local/bin:$PATH"
# Sửa xung đột giữa greenlet và gevent
# Cài đặt greenlet phiên bản tương thích với gevent 23.9.1
RUN pip3 install --no-cache-dir wheel setuptools pip --upgrade && \
pip3 install --no-cache-dir cryptography==3.4.8 && \
# Cài đặt greenlet phiên bản >= 3.0 trước khi cài gevent
pip3 install --no-cache-dir "greenlet>=3.0.0" && \
pip3 install --no-cache-dir gevent==23.9.1 && \
git clone --depth 1 --branch $ODOO_VERSION --single-branch https://github.com/odoo/odoo $ODOO_HOME/odoo-src && \
cd $ODOO_HOME/odoo-src && \
pip3 install --user --no-cache-dir -e . && \
pip3 install --user --no-cache-dir -r requirements.txt
# Install additional required Python libraries
COPY ./requirements.txt /tmp/
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt && \
rm /tmp/requirements.txt
# Copy configuration files
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/
COPY ./wait-for-psql.py /usr/local/bin/wait-for-psql.py
COPY ./odoo-bin $ODOO_HOME/odoo-src/
# Set permissions
RUN chmod +x /usr/local/bin/wait-for-psql.py && \
chmod +x $ODOO_HOME/odoo-src/odoo-bin && \
chmod +x /entrypoint.sh
# Expose Odoo ports
EXPOSE 8069 8072
# Set the working directory
WORKDIR $ODOO_HOME/odoo-src
ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment