FROM odoo@sha256:076562619a5de059388d9f9d90545cb575799c04869610a5b20839893819b41b AS trimmed
USER root
COPY exclude_unused_themes.py /tmp/poc-exclude-unused-themes.py
RUN python3 /tmp/poc-exclude-unused-themes.py && rm /tmp/poc-exclude-unused-themes.py

# Copy the cleaned filesystem into a new image: excluded themes are not retained in lower layers.
FROM scratch
COPY --from=trimmed / /
ENV LANG=en_US.UTF-8 ODOO_VERSION=19.0 ODOO_RC=/etc/odoo/odoo.conf
EXPOSE 8069 8071 8072
USER odoo
ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
