Skip to content

Commit

Permalink
Add ak-entrypoint-light in light version, and add the minimal tooling…
Browse files Browse the repository at this point in the history
… for running the test and coverage
  • Loading branch information
sebastienbeau committed Feb 11, 2025
1 parent c28edad commit f7f78c5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
14 changes: 13 additions & 1 deletion 16.0-light/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL org.opencontainers.image.authors="Akretion"
# syntax = docker/dockerfile:1.4

# List from https://github.com/camptocamp/docker-odoo-project/blob/master/16.0/Dockerfile
ENV BUILD_PACKAGE \
ENV BUILD_PACKAGE =\
build-essential \
gcc \
${PYTHONBIN}-dev \
Expand All @@ -24,16 +24,28 @@ ENV BUILD_PACKAGE \
# Additionnal dep from Ak
po4a \
libpq-dev \
expect \
postgresql-client

RUN --mount=type=cache,target=/var/cache/apt \
apt-get update \
&& apt-get install -y --no-install-recommends $BUILD_PACKAGE

# Install tooling for running test and coverage
ENV PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin
RUN --mount=type=cache,target=/root/.cache\
python3 -m pip install pipx &&\
pipx install manifestoo &&\
pipx install coverage

COPY 16.0/base_requirements.txt /tmp/base_requirements.txt
RUN pip install --no-cache-dir -r /tmp/base_requirements.txt

COPY 16.0-light/ak_requirements.txt /tmp/ak_requirements.txt
RUN pip install --no-cache-dir -r /tmp/ak_requirements.txt

# customize entrypoint
COPY bin/ak-entrypoint-light.sh /usr/local/bin/ak-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/ak-entrypoint.sh"]

CMD ["odoo"]
16 changes: 16 additions & 0 deletions bin/ak-entrypoint-light.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -Eeuo pipefail

# When using docky open the bedrock entrypoint is not run
# and so the PG variable are not initialized with the odoo variable
# to have a working postgresql-client working without setting odoo and PG variable
# it simplier to use native PG variable and map them to odoo
# So in docker-compose.yml only set the PG variable and it will work

export DB_HOST=${PGHOST}
export DB_PORT=${PGPORT:-5432}
export DB_USER=${PGUSER}
export DB_PASSWORD=${PGPASSWORD}
export DB_NAME=${PGDATABASE}

/usr/local/bin/entrypoint.sh "$@"
8 changes: 5 additions & 3 deletions bin/ak-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
USER_ID=${LOCAL_USER_ID:-999}


# When using docky open the entrypoint is not run
# this mean we do not have the variable mapping from odoo db variable => postgres variable
# as we need to have the postgres always set we use it in docker-compose file and map them to odoo variable
# When using docky open the bedrock entrypoint is not run
# and so the PG variable are not initialized with the odoo variable
# to have a working postgresql-client working without setting odoo and PG variable
# it simplier to use native PG variable and map them to odoo
# So in docker-compose.yml only set the PG variable and it will work

export DB_HOST=${PGHOST}
export DB_PORT=${PGPORT:-5432}
Expand Down

0 comments on commit f7f78c5

Please sign in to comment.