IMAGE odoo_14.0.0-210320
FROM alpine3.12-python3.8_3.8.5-210106

RUN EOF
    # Install runtime dependencies
    apk --no-cache add libffi libjpeg-turbo libpq nodejs wkhtmltopdf

    # Install build dependencies
    apk --no-cache add --virtual .deps build-base git libffi-dev libjpeg-turbo-dev libxml2-dev libxslt-dev linux-headers openldap-dev postgresql-dev python3-dev

    # Clone Odoo repository
    git clone -b 14.0 --depth 1 https://github.com/odoo/odoo.git /srv/odoo

    # Install Odoo
    cd /srv/odoo
    pip3 install -r requirements.txt

    # Create OS user
    addgroup -S -g 8080 odoo
    adduser -S -u 8080 -h /srv/odoo -s /bin/false -g odoo -G odoo odoo
    chown -R odoo:odoo /srv/odoo

    # Cleanup
    apk --no-cache del .deps
    find /srv/odoo -name '.git*' -exec rm -rf {} +
    rm -rf /usr/local/share/.cache
EOF

USER odoo
CMD /srv/odoo/odoo-bin -c srv/odoo/odoo.conf
