Dockerfile

FROM debian:buster
MAINTAINER Lnace <lin20080369@126.com>

SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

ENV LC_ALL C.UTF-8

RUN apt-get update \
        && apt-get install -y \
            ca-certificates \
            curl \
            dirmngr \
            fonts-noto-cjk \
            gnupg \
            libssl-dev \
            node-less \
            npm \
            python3-num2words \
            python3-pip \
            python3-phonenumbers \
            python3-pyldap \
            python3-qrcode \
            python3-renderpm \
            python3-setuptools \
            python3-slugify \
            python3-vobject \
            python3-watchdog \
            python3-xlrd \
            python3-xlwt \
            xz-utils \
            python3-dev \
            libxml2-dev \
            libxslt1-dev \
            libldap2-dev \
            libsasl2-dev \
            libtiff5-dev \
            libjpeg62-turbo-dev \
            libopenjp2-7-dev \
            zlib1g-dev \
            libfreetype6-dev \
            liblcms2-dev \
            libwebp-dev \
            libharfbuzz-dev \
            libfribidi-dev \
            libxcb1-dev \
            libpq-dev \
        && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
        && echo 'ea8277df4297afc507c61122f3c349af142f31e5 wkhtmltox.deb' | sha1sum -c - \
        && apt-get install -y ./wkhtmltox.deb \
        && rm -rf /var/lib/apt/lists/* wkhtmltox.deb

RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
        && GNUPGHOME="$(mktemp -d)" \
        && export GNUPGHOME \
        && repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
        && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "${repokey}" \
        && gpg --batch --armor --export "${repokey}" > /etc/apt/trusted.gpg.d/pgdg.gpg.asc \
        && gpgconf --kill all \
        && rm -rf "$GNUPGHOME" \
        && apt-get update  \
        && apt-get install --no-install-recommends -y postgresql-client \
        && rm -f /etc/apt/sources.list.d/pgdg.list \
        && rm -rf /var/lib/apt/lists/*

RUN npm install -g rtlcss

COPY ./config/odoo.conf /etc/odoo/odoo.conf

RUN adduser --disabled-password --gecos "" odoo \
    && chown odoo /etc/odoo/odoo.conf \
    && mkdir -p /home/odoo \
    && chown -R odoo /home/odoo \
    && mkdir -p /var/log/odoo \
    && chown odoo /var/log/odoo \
    && mkdir -p /var/lib/odoo \
    && chown -R odoo /var/lib/odoo

VOLUME ["/var/lib/odoo", "/home/odoo","/var/log/odoo"]

COPY ./requirements.txt /home/odoo/requirements.txt

RUN pip3 install -r /home/odoo/requirements.txt

EXPOSE 8069 8090

USER odoo

WORKDIR /home/odoo/


requirements.txt

wheel==0.32.3
Babel==2.6.0
chardet==3.0.4
decorator==4.3.0
docutils==0.14
ebaysdk==2.1.5
feedparser==5.2.1
gevent==1.1.2 ; sys_platform != 'win32' and python_version < '3.7'
gevent==1.5.0 ; python_version >= '3.7'
gevent==1.4.0 ; sys_platform == 'win32' and python_version < '3.7'
greenlet==0.4.10 ; python_version < '3.7'
greenlet==0.4.15 ; python_version >= '3.7'
html2text==2018.1.9
Jinja2==2.10.1
libsass==0.17.0
lxml==3.7.1 ; sys_platform != 'win32' and python_version < '3.7'
lxml==4.3.2 ; sys_platform != 'win32' and python_version >= '3.7'
lxml ; sys_platform == 'win32'
Mako==1.0.7
MarkupSafe==1.1.0
mock==2.0.0
num2words==0.5.6
ofxparse==0.19
passlib==1.7.1
Pillow==5.4.1 ; python_version < '3.7' or sys_platform != 'win32'
Pillow==6.1.0 ; sys_platform == 'win32' and python_version >= '3.7'
polib==1.1.0
psutil==5.6.6
psycopg2==2.7.7 --no-binary psycopg2
pydot==1.4.1
python-ldap==3.1.0; sys_platform != 'win32'
pyparsing==2.2.0
PyPDF2==1.26.0
pyserial==3.4
python-dateutil==2.7.3
pytz==2019.1
pyusb==1.0.2
qrcode==6.1
reportlab==3.5.13
requests==2.21.0
zeep==3.2.0
vatnumber==1.2
vobject==0.9.6.1
Werkzeug==0.14.1 ; sys_platform != 'win32'
Werkzeug==0.16.0 ; sys_platform == 'win32'
XlsxWriter==1.1.2
xlwt==1.3.*
xlrd==1.1.0
pypiwin32 ; sys_platform == 'win32'


docker-compose.yml

version: '2'
services:
  web:
    container_name: web
    build: .
    restart: always
    depends_on:
      - db
    ports:
      - "${WEB_PORT}:${CONTAINER_WEB_PORT}"
    volumes:
      - odoo-web-data:/var/lib/odoo
      - odoo-log-data:/var/log/odoo
      - .:/home/odoo
      - ./config:/etc/odoo
    command: python3 odoo-bin -c /etc/odoo/odoo.conf --log-level=${LOG_LEVEL} --log-handler=${LOG_HANDLER} --http-port=${CONTAINER_WEB_PORT} --db_user=${DB_USER} --db_password=${DB_PASSWORD} --db_port=${CONTAINER_DB_PORT} --db_host=${DB_HOST}
  db:
    container_name: db
    image: postgres:9.6.22
    restart: always
    ports:
      - "${DB_PORT}:${CONTAINER_DB_PORT}"
    environment:
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
volumes:
  odoo-web-data:
  odoo-log-data:
  odoo-db-data:

.env

DB_PORT=5432
DB_HOST=db
POSTGRES_DB=postgres
DB_USER=odoo
DB_PASSWORD=odoo
CONTAINER_DB_PORT=5432
WEB_PORT=8070
CONTAINER_WEB_PORT=8069
LOG_LEVEL=debug
LOG_HANDLER=odoo.http:DEBUG


docker-compose up -d