Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6298 Lượt xem

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.



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

"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?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 23
1954
3
thg 3 25
3262
4
thg 12 23
45527
1
thg 1 23
3450
1
thg 3 24
6209