aboutsummaryrefslogtreecommitdiff
path: root/ansible/odoo/docker
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-08-01 09:17:28 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-08-08 09:03:13 +0200
commitfe4b8b3a499270df23b1ac3f0d8ec17e22f055ae (patch)
treec4289930d02edfbec8e5ce590bf847053e304f41 /ansible/odoo/docker
parentb013a2d14b99eb3d76877e52f863832e421d3d70 (diff)
downloadinfra-fe4b8b3a499270df23b1ac3f0d8ec17e22f055ae.tar.gz
infra-fe4b8b3a499270df23b1ac3f0d8ec17e22f055ae.tar.bz2
infra-fe4b8b3a499270df23b1ac3f0d8ec17e22f055ae.tar.xz
infra-fe4b8b3a499270df23b1ac3f0d8ec17e22f055ae.zip
o Building my own variant of odoo:12, based on upstream odoo:12 with
support for setting admin_passwd.
Diffstat (limited to 'ansible/odoo/docker')
-rw-r--r--ansible/odoo/docker/Dockerfile10
-rw-r--r--ansible/odoo/docker/Makefile6
-rwxr-xr-xansible/odoo/docker/set-admin-passwd.sh15
3 files changed, 31 insertions, 0 deletions
diff --git a/ansible/odoo/docker/Dockerfile b/ansible/odoo/docker/Dockerfile
new file mode 100644
index 0000000..130adea
--- /dev/null
+++ b/ansible/odoo/docker/Dockerfile
@@ -0,0 +1,10 @@
+FROM odoo:12
+
+RUN pip3 install phonenumbers
+COPY ./set-admin-passwd.sh /
+VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
+
+EXPOSE 8069 8072
+USER odoo
+ENTRYPOINT ["/set-admin-passwd.sh"]
+CMD ["odoo"]
diff --git a/ansible/odoo/docker/Makefile b/ansible/odoo/docker/Makefile
new file mode 100644
index 0000000..d399777
--- /dev/null
+++ b/ansible/odoo/docker/Makefile
@@ -0,0 +1,6 @@
+TAG=trygvis/odoo:12
+
+all:
+ docker pull odoo:12
+ docker build -t $(TAG) .
+ docker push $(TAG)
diff --git a/ansible/odoo/docker/set-admin-passwd.sh b/ansible/odoo/docker/set-admin-passwd.sh
new file mode 100755
index 0000000..4c363b1
--- /dev/null
+++ b/ansible/odoo/docker/set-admin-passwd.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -euo pipefail
+
+: ${ADMIN_PASSWD:=`< /dev/urandom tr -dc A-Za-z0-9 | head -c16; echo`}
+
+# /etc/odoo is owned by root, can't create new files.
+TMPFILE=$(mktemp)
+sed -e "/^admin_passwd/d" \
+ -e "$ a admin_passwd = $ADMIN_PASSWD" \
+ $ODOO_RC > $TMPFILE
+cat $TMPFILE > $ODOO_RC
+rm -f $TMPFILE
+
+exec /entrypoint.sh "${@}"