-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
111 lines (98 loc) · 3.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
ARG \
PYTHON_VERSION
FROM python:${PYTHON_VERSION}-bookworm as builder
ARG \
DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
COPY ./odoo/requirements.txt /tmp/requirements.txt
RUN set -ex; \
apt update; \
apt upgrade -y; \
apt install --no-install-recommends -y \
git \
file \
curl \
util-linux \
libxslt-dev \
libzip-dev \
libldap2-dev \
libsasl2-dev \
libpq-dev \
libjpeg-dev \
gcc \
g++ \
build-essential;
RUN pip wheel -r /tmp/requirements.txt phonenumbers uwsgi --wheel-dir /usr/src/app/wheels
FROM python:${PYTHON_VERSION}-bookworm as runner
LABEL org.opencontainers.image.authors="Syahrial Agni Prasetya <[email protected]>"
LABEL org.opencontainers.image.licenses="LGPL-3.0"
LABEL org.opencontainers.image.vendor="M+ Software"
LABEL org.opencontainers.image.title="Odoo"
LABEL org.opencontainers.image.description="Open Source ERP and CRM"
ARG \
DEBIAN_FRONTEND=noninteractive \
NODEJS_VERSION=20 \
WKHTMLTOPDF_VERSION=0.12.6.1-2
ENV PYTHONUNBUFFERED=1
# Install Odoo Dependencies
COPY --from=builder /usr/src/app/wheels /wheels/
RUN set -ex; \
apt update; \
apt upgrade -y; \
apt install --no-install-recommends -y \
git \
file \
curl \
screen \
util-linux \
vim \
zstd \
pspg \
zstd \
htop; \
pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/*; \
rm -rf /wheels/
# Install PostgreSQL client
RUN set -ex; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/keyrings/pgdg.gpg; \
. /etc/os-release; \
echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] https://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \
apt update; \
apt install -y postgresql-client-16 postgresql-client-15 postgresql-client-14 postgresql-client-13 postgresql-client-12 postgresql-client-9.6
# Install Wkhtmltopdf
COPY --from=registry.mitija.com/library/mwkhtmltopdf-client:latest /usr/local/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
# Install NodeJS
RUN set -ex; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list; \
apt update; \
apt install -y --no-install-recommends \
nodejs; \
npm install -g rtlcss [email protected]
# Install Odoo
ENV PIP_CACHE_DIR /opt/odoo/pip-cache
RUN set -ex; \
mkdir -p /opt/odoo/logs /opt/odoo/data /opt/odoo/etc /opt/odoo/pip-cache /opt/odoo/extra-addons; \
cd /opt/odoo; \
ln -sf server s; ln -sf extra-addons e; \
useradd -d /opt/odoo odoo -s /bin/bash; \
chown -R odoo:odoo /opt/odoo
COPY --chown=odoo:odoo ./odoo /opt/odoo/server
ENV PAGER="pspg --reprint-on-exit --blackwhite --bold-labels"
# Copy configuration
COPY ./src/entrypoint.sh /entrypoint.sh
COPY --chown=odoo:odoo ./src/.bashrc /opt/odoo/.bashrc
# Copy scripts
COPY ./src/bin/* /usr/local/bin/
RUN chmod +x /usr/local/bin/*
# Copy https://github.com/mplus-oss/cloud-addons
COPY --chown=odoo:odoo ./cloud-addons /opt/odoo/server/cloud-addons
# EXPOSE doesn't actually do anything, it's just gives metadata to the container
EXPOSE 8069 8072
# Set cwd
WORKDIR /opt/odoo
# Set user
USER odoo
# Run Entrypoint
ENTRYPOINT ["/entrypoint.sh"]