[UPD] docker: Clean files

This commit is contained in:
Mathieu Benoit 2020-08-01 14:17:39 -04:00
parent 49021ebd19
commit 789a26a432
5 changed files with 97 additions and 102 deletions

View file

@ -1,5 +1,5 @@
FROM debian:buster-slim FROM debian:buster-slim
MAINTAINER Odoo S.A. <info@odoo.com> MAINTAINER TechnoLibre <info@technolibre.ca>
SHELL ["/bin/bash", "-xo", "pipefail", "-c"] SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
@ -9,7 +9,6 @@ ENV LANG C.UTF-8
ENV ODOO_PREFIX /ERPLibre ENV ODOO_PREFIX /ERPLibre
ENV ODOO_EXEC_BIN $ODOO_PREFIX/odoo/odoo-bin ENV ODOO_EXEC_BIN $ODOO_PREFIX/odoo/odoo-bin
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf # Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
@ -44,7 +43,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \ && apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
# dpkg-deb -I odoo.deb | grep Depends: | sed "s/ /\\n/g" | egrep '^python\-*' | sed "s/,//g" # dpkg-deb -I odoo.deb | grep Depends: | sed "s/ /\\n/g" | egrep '^python\-*' | sed "s/,//g"
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
@ -102,16 +100,13 @@ RUN cd ; mkdir -p .bin/ && \
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && \ curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && \
chmod +x /usr/bin/repo && sed -i '1 s/python$/python3/' /usr/bin/repo chmod +x /usr/bin/repo && sed -i '1 s/python$/python3/' /usr/bin/repo
RUN groupadd --gid 101 --force odoo && \ RUN groupadd --gid 101 --force odoo && \
useradd --non-unique --create-home --uid 101 --gid 101 odoo useradd --non-unique --create-home --uid 101 --gid 101 odoo
# Copy entrypoint script and Odoo configuration file # Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh / COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
# # Set the default config file # # Set the default config file
ENV ODOO_RC /etc/odoo/odoo.conf ENV ODOO_RC /etc/odoo/odoo.conf
COPY ./odoo.conf $ODOO_RC COPY ./odoo.conf $ODOO_RC

View file

@ -1,9 +1,10 @@
FROM technolibre/erplibre-base:12.0 FROM technolibre/erplibre-base:12.0
ENV REPO_MANIFEST_URL http://git.erplibre.ca/ERPLibre ENV REPO_MANIFEST_URL http://git.erplibre.ca/ERPLibre
RUN cat /etc/os-release
ENV BRANCH_ERPLIBRE dev/1.1.0 ENV BRANCH_ERPLIBRE dev/1.1.0
RUN cat /etc/os-release
USER root USER root
# Install Odoo # Install Odoo
@ -22,8 +23,8 @@ RUN mkdir ~/.ssh/ && echo "StrictHostKeyChecking no" >> ~/.ssh/config && apt u
RUN cd ; mkdir -p .bin/ && \ RUN cd ; mkdir -p .bin/ && \
git config --global color.ui false && \ git config --global color.ui false && \
git config --global user.email "foo@bar.io" && \ git config --global user.email "mathben@technolibre.ca" && \
git config --global user.name "Foo Bar" && \ git config --global user.name "Mathieu Benoit" && \
mkdir -p $ODOO_PREFIX && cd $ODOO_PREFIX && \ mkdir -p $ODOO_PREFIX && cd $ODOO_PREFIX && \
repo init -u $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE && \ repo init -u $REPO_MANIFEST_URL -b $BRANCH_ERPLIBRE && \
repo sync -j 4 -c repo sync -j 4 -c

View file

@ -2,25 +2,26 @@
import argparse import argparse
from os import listdir from os import listdir
from os.path import isdir, join, abspath from os.path import isdir, join, abspath
import configparser import configparser
parser = argparse.ArgumentParser(prog='Configure base dir for all addons') parser = argparse.ArgumentParser(prog='Configure base dir for all addons')
parser.add_argument("addonsBaseDir", help="Path where addons are checkouted") parser.add_argument("addonsBaseDir", help="Path where addons are cloned.")
parser.add_argument("srcConfigPath", help="Path where we retreive source config file to adapt with new addons path") parser.add_argument("srcConfigPath",
parser.add_argument("dstConfigPath", help="Path to save adapted cpnfiguration") help="Path where we retrieve source config file to adapt with new "
"addons path.")
parser.add_argument("dstConfigPath", help="Path to save adapted configuration.")
args = parser.parse_args() args = parser.parse_args()
addonsBaseDir = args.addonsBaseDir addonsBaseDir = args.addonsBaseDir
srcConfigPath = args.srcConfigPath srcConfigPath = args.srcConfigPath
dstConfigPath = args.dstConfigPath dstConfigPath = args.dstConfigPath
addonsDirs = [ abspath(join(addonsBaseDir, f)) for f in listdir(addonsBaseDir) if isdir(join(addonsBaseDir, f))] addonsDirs = [abspath(join(addonsBaseDir, f)) for f in listdir(addonsBaseDir) if
isdir(join(addonsBaseDir, f))]
# addonsDirs.insert(0, "/usr/lib/python3/dist-packages/odoo/addons/") # addonsDirs.insert(0, "/usr/lib/python3/dist-packages/odoo/addons/")
addonsDirs.insert(0, "/ERPLibre/odoo/addons/") addonsDirs.insert(0, "/ERPLibre/odoo/addons/")

View file

@ -10,7 +10,7 @@ if __name__ == '__main__':
arg_parser.add_argument('--db_port', required=True) arg_parser.add_argument('--db_port', required=True)
arg_parser.add_argument('--db_user', required=True) arg_parser.add_argument('--db_user', required=True)
arg_parser.add_argument('--db_password', required=True) arg_parser.add_argument('--db_password', required=True)
# arg_parser.add_argument('--db_name', required=True) arg_parser.add_argument('--db_name', required=False, default="postgres")
arg_parser.add_argument('--timeout', type=int, default=10) arg_parser.add_argument('--timeout', type=int, default=10)
args = arg_parser.parse_args() args = arg_parser.parse_args()
@ -24,17 +24,15 @@ if __name__ == '__main__':
try: try:
conn = psycopg2.connect(user=args.db_user, host=args.db_host, 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") dbname=args.db_name)
break break
except psycopg2.OperationalError as e: except psycopg2.OperationalError as e:
error = e error = e
print(".")
time.sleep(1)
else: else:
connected = True connected = True
conn.close() conn.close()
print(".")
time.sleep(1)
if error: if error:
print("Database connection failure: %s" % error, file=sys.stderr) print("Database connection failure: %s" % error, file=sys.stderr)
sys.exit(1) sys.exit(1)