Skip to Content
Menu
This question has been flagged
1 Reply
4606 Views

Hello everybody,  I am trying to run odoo with docker compose.


Here a little context to what I am trying to do:


I forked the official Odoo repo and added a new folder for my custom addons and also a odoo.conf file: https://github.com/amunoz-pdc/odoo_18


There, I also have a Dockerfile to run Odoo from the code that I have there, not from an official image. Also I have a docker-compose.yml to run everything togheter. (Odoo from code and postgres)


I am having difficulties with the Dockerfile for Odoo. I tried with a few tutorials and also chatgpt but nothing seems to work.


Here the Dockefile:

# Use official Python image as a base
FROM python:3.12
LABEL authors="amunoz"

# Set working directory
WORKDIR /opt/odoo

# Install system dependencies
RUN apt-get update && \
apt-get install -y \
build-essential \
libxml2-dev \
libssl-dev \
libsasl2-dev \
libldap2-dev \
zlib1g-dev \
libjpeg-dev \
liblcms2-dev \
libblas-dev \
libatlas-base-dev \
git \
npm \
&& apt-get clean

# Copy your Odoo source code
COPY . /opt/odoo/

# Copy the Odoo configuration file
COPY odoo.conf /etc/odoo/odoo.conf

# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

# Expose the Odoo port
EXPOSE 8069

# Set environment variables for Odoo
ENV ODOO_CONFIG=/etc/odoo/odoo.conf

# Start Odoo
CMD ["python", "odoo-bin", "-c", "/etc/odoo/odoo.conf"]


And here my docker-compose.yml file:

version: '3.8'

services:
odoo:
build: .
container_name: odoo
depends_on:
- db
ports:
- "8069:8069"
volumes:
- .:/opt/odoo
- /etc/odoo/odoo.conf:/etc/odoo/odoo.conf
environment:
- ODOO_CONFIG=/etc/odoo/odoo.conf
networks:
- odoo_network
restart: always

db:
image: postgres:15
container_name: odoo-db
environment:
POSTGRES_DB: odoo
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
volumes:
- odoo-db-data:/var/lib/postgresql/data
networks:
- odoo_network
restart: always

volumes:
odoo-db-data:

networks:
odoo_network:
driver: bridge


My goal Is to be able to run Odoo with docker compose from PyCharm.


I want to to develop and debug the code with PyCharm.


Any help would be greatly appreciated


Thank you in advance.



Avatar
Discard
Best Answer

"My goal Is to be able to run Odoo with docker compose from PyCharm.

I want to to develop and debug the code with PyCharm."

Then I would say save your time and don't build a docker. Its a PITA to debug there, and every time you make changes to the code (python) you will need to stop the container and start it again.

That said, if you insist on building a developement environment in a docker, what issue ddid you run into? What is not working?

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 23
1433
3
Mar 25
2646
4
Dec 23
44561
1
Jan 23
3034
1
Mar 24
5624