Skip to content

Commit b0f7275

Browse files
committed
[WIP] Add devcontainer
1 parent 72b9304 commit b0f7275

8 files changed

+160
-1
lines changed

.devcontainer/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.11-bookworm
2+
3+
ENV PAGER=more
4+
RUN git config --global core.autocrlf true
5+
6+
RUN apt-get update && apt-get install -y git postgresql-client
7+
RUN pip install --no-cache-dir git-aggregator==4.0.2 click==8.1.8 pre-commit==4.1.0

.devcontainer/devcontainer.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "Curq",
3+
"dockerComposeFile": "docker-compose.yaml",
4+
"service": "curq",
5+
"workspaceFolder": "/workspace/${localWorkspaceFolderBasename}",
6+
"forwardPorts": [8069, 5432],
7+
"customizations": {
8+
"vscode": {
9+
"settings": {
10+
"terminal.integrated.shell.linux": "/bin/bash",
11+
"python.defaultInterpreterPath": "/usr/local/bin/python"
12+
},
13+
"extensions": [
14+
"ms-azuretools.vscode-docker",
15+
"redhat.vscode-yaml",
16+
"ecmel.vscode-html-css"
17+
]
18+
}
19+
},
20+
"features": {
21+
"ghcr.io/devcontainers/features/python:1": "none",
22+
"ghcr.io/devcontainers/features/git:1": {
23+
"version": "latest",
24+
"ppa": "false"
25+
}
26+
},
27+
"onCreateCommand": "bash .devcontainer/on-create.sh"
28+
}

.devcontainer/docker-compose.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "3.8"
2+
3+
services:
4+
curq:
5+
build:
6+
context: ..
7+
dockerfile: .devcontainer/Dockerfile
8+
9+
volumes:
10+
- ../..:/workspace:cached
11+
- odoo-data:/odoo-data
12+
13+
command: sleep infinity
14+
network_mode: service:postgres
15+
16+
postgres:
17+
image: postgres:13
18+
restart: unless-stopped
19+
volumes:
20+
- postgres-data:/var/lib/postgresql/data
21+
environment:
22+
POSTGRES_USER: odoo
23+
POSTGRES_DB: odoo
24+
POSTGRES_PASSWORD: odoo
25+
26+
volumes:
27+
postgres-data:
28+
odoo-data:

.devcontainer/odoo.cfg.tmpl

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[options]
2+
addons_path = ${PWD},${PWD}/.repos/addons-oca,${PWD}/.repos/addons-generic,${PWD}/.repos/addons-sendcloud,${PWD}/.repos/addons-third-party
3+
data_dir = /odoo-data
4+
auto_reload = False
5+
db_template = template1
6+
db_host = localhost
7+
db_port = 5432
8+
db_user = odoo
9+
db_password = odoo
10+
db_sslmode = prefer
11+
list_db = True
12+
admin_passwd = admin
13+
db_maxconn = 64
14+
limit_memory_soft = 2147483648
15+
limit_memory_hard = 2684354560
16+
limit_request = 8192
17+
limit_time_cpu = 60
18+
limit_time_real = 120
19+
limit_time_real_cron = -1
20+
log_handler = :INFO
21+
log_level = info
22+
max_cron_threads = 2
23+
logfile = None
24+
log_db = False
25+
server_wide_modules = web,base

.devcontainer/on-create.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -x
3+
4+
# # Aggregate other repositories
5+
gitaggregate -c repos-dev.yaml
6+
7+
# Install requirements
8+
pip install --no-cache-dir -r .repos/odoo/requirements.txt
9+
pip install --no-cache-dir -r requirements.txt
10+
pip install -e .repos/odoo
11+
12+
# Install pre-commit hooks
13+
pre-commit install
14+
15+
# Create config from template
16+
cat .devcontainer/odoo.cfg.tmpl | envsubst > odoo.cfg

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,11 @@ dmypy.json
130130

131131
# Editors
132132
.idea
133-
.vscode/
133+
.vscode/*
134+
!.vscode/launch.json
135+
136+
# Aggregated repos
137+
.repos/
138+
139+
# odoo.cfg created by devcontainer
140+
odoo.cfg

.vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python Debugger: Module",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"program": ".repos/odoo/odoo-bin",
9+
"console": "integratedTerminal",
10+
"args": [
11+
"-c",
12+
"odoo.cfg"
13+
]
14+
}
15+
]
16+
}

repos-dev.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
./.repos/odoo:
2+
defaults:
3+
depth: 10
4+
remotes:
5+
odoo: https://github.com/odoo/odoo.git
6+
merges:
7+
- remote: odoo
8+
ref: 38b6ebd18081a9026b912735e4326c0fa901331b
9+
10+
./.repos/addons-generic:
11+
remotes:
12+
onestein: https://github.com/onesteinbv/addons-generic.git
13+
merges:
14+
- onestein 16.0
15+
16+
./.repos/addons-oca:
17+
remotes:
18+
onestein: https://github.com/onesteinbv/addons-oca.git
19+
merges:
20+
- onestein 16.0
21+
22+
./.repos/addons-third-party:
23+
remotes:
24+
onestein: https://github.com/onesteinbv/addons-third-party.git
25+
merges:
26+
- onestein 16.0
27+
28+
./.repos/addons-sendcloud:
29+
remotes:
30+
onestein: https://github.com/onesteinbv/addons-sendcloud.git
31+
merges:
32+
- onestein 16.0

0 commit comments

Comments
 (0)