docker-odoo-project
docker-odoo-project copied to clipboard
Wrong VOLUME definition in 16.0 Dockerfile???? Error Permission pip egg UID
Here we can see volume data is set to:
https://github.com/camptocamp/docker-odoo-project/blob/0861fcdf65ffa1f987736831799ca5ba123db886/16.0/Dockerfile#L63
As for the rest wherever we see data directory for odoo settings we see:
https://github.com/camptocamp/docker-odoo-project/blob/0861fcdf65ffa1f987736831799ca5ba123db886/16.0/Dockerfile#L58
https://github.com/camptocamp/docker-odoo-project/blob/0861fcdf65ffa1f987736831799ca5ba123db886/16.0/Dockerfile#L80
I am getting permission problems when trying to use 16's image as base for my own image. pip is complaining about not enough permissions in /odoo/src directory to create the egg.info or something like that. I'm thinking the root cause could be connected to the volume definition. The errors arise when trying to build with build-arg UID=1000.
So volume should be /data/odoo or /odoo/data????
services:
odoo:
image: ${IMAGE}:${TAG}
build:
context: ./odoo/
network: host
args:
UID: ${UID}
CACHEBUST: 1
command: ['odoo', '--dev=xml,reload']
expose:
- "8069"
- "8072"
ports:
- "${WEB_PDB_PORT}:5555"
volumes:
- "odoo_data:/odoo/data"
- "${ENTERPRISE_REPO_PATH}:/odoo/external-src/enterprise"
- "${ADDONS_PATH}:/odoo/external-src/custom"
environment:
- PYTHONDONTWRITEBYTECODE=true
- ADMIN_PASSWD=admin
- DB_NAME=odoodb
- LIST_DB=True
- ODOO_BASE_URL=${ODOO_BASE_URL}
- ODOO_REPORT_URL=${ODOO_REPORT_URL}
- KWKHTMLTOPDF_SERVER_URL=${KWKHTMLTOPDF_SERVER_URL}
- MIGRATE=false
- LIMIT_TIME_REAL=1200000
- LIMIT_TIME_REAL_CRON=1200000
- PYTHONBREAKPOINT=web_pdb.set_trace
- WORKERS=0
# syntax = docker/dockerfile:1.2
FROM ghcr.io/camptocamp/odoo-project:16.0-5.0.5
COPY ./src /odoo/src
COPY ./VERSION /odoo/
COPY ./setup.py /odoo/
COPY ./requirements.txt /odoo/
RUN pip3 install -e /odoo
RUN pip3 install -e /odoo/src
# Project's specifics packages
ARG CACHEBUST
RUN cd /odoo && pip3 install -r requirements.txt
ENV ADDONS_PATH=/odoo/local-src,/odoo/external-src/enterprise,/odoo/external-src/custom
Installing collected packages: odoo
#0 1.858 Running setup.py develop for odoo
#0 2.389 error: subprocess-exited-with-error
#0 2.389
#0 2.389 × python setup.py develop did not run successfully.
#0 2.389 │ exit code: 1
#0 2.389 ╰─> [4 lines of output]
#0 2.389 running develop
#0 2.389 running egg_info
#0 2.389 creating odoo.egg-info
#0 2.389 error: could not create 'odoo.egg-info': Permission denied
#0 2.389 [end of output]
#0 2.389
#0 2.389 note: This error originates from a subprocess, and is likely not a problem with pip.
#0 2.402 error: subprocess-exited-with-error
#0 2.402
#0 2.402 × python setup.py develop did not run successfully.
#0 2.402 │ exit code: 1
#0 2.402 ╰─> [4 lines of output]
#0 2.402 running develop
#0 2.402 running egg_info
#0 2.402 creating odoo.egg-info
#0 2.402 error: could not create 'odoo.egg-info': Permission denied
#0 2.402 [end of output]
#0 2.402
#0 2.402 note: This error originates from a subprocess, and is likely not a problem with pip.
------
failed to solve: process "/bin/sh -c pip3 install -e /odoo/src" did not complete successfully: exit code: 1
At least the volume definition isn't the root cause. I rebuilt the image changing volume from /data/odoo to /odoo/data same result. But it seems like building process ignores custom UID no matters what.
Running with:
docker compose build --no-cache --build-arg UID=$(id -u) --progress plain odoo
With a layer:
RUN echo $(id)
Shows:
#15 [7/9] RUN echo $(id)
#15 0.118 uid=999(odoo) gid=999(odoo) groups=999(odoo)
#15 DONE 0.1s
It seems the permission problem is because my UID=1000 but odoo inside the build despite the build-arg still 999. I would like to point at this doesn't happen with 15.0 image. UPDATE: I believe the volume definition is an issue but the UID problem is not. I have finally understood it is camptocamp image that accepts UID as a build arg, I was passing UID as a build arg for my own image. Still, I'm letting this open so anyone could clarify the volume definition problem.