Skip to content

Commit

Permalink
[update] move on ubuntu and update python version
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafabarmshory committed Feb 7, 2024
1 parent 3740252 commit 0c1e6ea
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Odoo Runner 16.0 Docker image
- name: Build the Odoo Runner 17.0 Docker image
run: |
timetag=(`date +%Y%M%d`)
docker build . --tag ghcr.io/viraweb123/odoo-runner:16.0.${timetag} --tag ghcr.io/viraweb123/odoo-runner:16.0
docker push ghcr.io/viraweb123/odoo-runner:16.0
docker push ghcr.io/viraweb123/odoo-runner:16.0.${timetag}
docker build . --tag ghcr.io/viraweb123/odoo-runner:17.0.${timetag} --tag ghcr.io/viraweb123/odoo-runner:17.0
docker push ghcr.io/viraweb123/odoo-runner:17.0
docker push ghcr.io/viraweb123/odoo-runner:17.0.${timetag}
53 changes: 32 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM debian:bullseye-slim
FROM ubuntu:jammy

SHELL ["/bin/bash", "-xo", "pipefail", "-c"]

# Generate locale C.UTF-8 for postgres and general locale data
ENV LANG C.UTF-8
ENV LANG en_US.UTF-8

# Retrieve the target architecture to install the correct wkhtmltopdf package
# ARG TARGETARCH amd64

# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN apt-get update && \
apt-get install --no-install-recommends -y \

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dirmngr \
Expand All @@ -16,7 +20,9 @@ RUN apt-get update && \
libssl-dev \
node-less \
npm \
python3-magic \
python3-num2words \
python3-odf \
python3-pdfminer \
python3-pip \
python3-phonenumbers \
Expand All @@ -30,16 +36,19 @@ RUN apt-get update && \
python3-xlrd \
python3-xlwt \
xz-utils \
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
&& echo 'ea8277df4297afc507c61122f3c349af142f31e5 wkhtmltox.deb' | sha1sum -c - \
&& apt-get install --no-install-recommends -y ./wkhtmltox.deb \
&& rm -rf wkhtmltox.deb \
&& TARGETARCH=amd64 \
&& WKHTMLTOPDF_ARCH=amd64 \
&& WKHTMLTOPDF_SHA=967390a759707337b46d1c02452e2bb6b2dc6d59 \
&& curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_${WKHTMLTOPDF_ARCH}.deb \
&& echo ${WKHTMLTOPDF_SHA} wkhtmltox.deb | sha1sum -c - \
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/logs/* \
&& rm -fr /tmp/*

# install latest postgresql-client
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
&& GNUPGHOME="$(mktemp -d)" \
&& export GNUPGHOME \
&& repokey='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8' \
Expand All @@ -61,10 +70,7 @@ RUN npm install -g rtlcss \
&& rm -rf /var/logs/* \
&& rm -fr /tmp/*

# Install Odoo
ENV ODOO_VERSION 16.0
ARG ODOO_RELEASE=20230109
ARG ODOO_SHA=884bf72c7318835b9ac56be2594032cbba7b8c7b
# Install Odoo tools
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
adduser \
Expand Down Expand Up @@ -121,18 +127,17 @@ RUN apt-get update \
&& rm -fr /tmp/*

# Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/
COPY wait-for-psql.py /usr/local/bin/wait-for-psql.py
COPY ./entrypoint.sh /
COPY ./odoo.conf /etc/odoo/
COPY ./wait-for-psql.py /usr/local/bin/wait-for-psql.py

# Set permissions and Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
RUN adduser --system \
--home /var/lib/odoo \
--quiet --group odoo \
# && chown odoo:odoo /var/lib/odoo \
# && chown odoo /etc/odoo/odoo.conf \
&& chown odoo /etc/odoo/odoo.conf \
&& mkdir -p /mnt/extra-addons \
# && chown -R odoo /mnt/extra-addons
&& chown -R odoo /mnt/extra-addons
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]

# Expose Odoo services
Expand All @@ -143,7 +148,13 @@ ENV ODOO_RC /etc/odoo/odoo.conf


# Set default user when running the container
# USER odoo
#USER odoo

ENTRYPOINT ["/entrypoint.sh"]
CMD ["odoo"]
CMD ["odoo"]






6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ case "$1" in
-- | odoo)
shift
if [[ "$1" == "scaffold" ]] ; then
exec python3 /var/lib/odoo/odoo-bin "$@"
exec odoo "$@"
else
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec python3 /var/lib/odoo/odoo-bin "$@" "${DB_ARGS[@]}"
exec odoo "$@" "${DB_ARGS[@]}"
fi
;;
-*)
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
exec python3 /var/lib/odoo/odoo-bin "$@" "${DB_ARGS[@]}"
exec odoo "$@" "${DB_ARGS[@]}"
;;
*)
exec "$@"
Expand Down
6 changes: 3 additions & 3 deletions wait-for-psql.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
start_time = time.time()
while (time.time() - start_time) < args.timeout:
try:
conn = psycopg2.connect(user=args.db_user,
conn = psycopg2.connect(user=args.db_user,
host=args.db_host,
port=args.db_port,
password=args.db_password,
port=args.db_port,
password=args.db_password,
dbname='postgres')
error = ''
break
Expand Down

0 comments on commit 0c1e6ea

Please sign in to comment.