initial commit
This commit is contained in:
commit
bebc48d41c
6
README.md
Normal file
6
README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Odoo PosBox in Docker
|
||||||
|
|
||||||
|
Dockerfiles and Docker Compose configuration for running
|
||||||
|
Odoo PosBox in Docker. It additionally contains
|
||||||
|
[pos-addons](https://github.com/it-projects-llc/pos-addons)
|
||||||
|
for using receipt printers over the network.
|
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: ./odoo
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- 8069:8069
|
||||||
|
volumes:
|
||||||
|
- odoo-web-data:/var/lib/odoo
|
||||||
|
networks:
|
||||||
|
localnet:
|
||||||
|
ipv4_address: 10.5.0.2
|
||||||
|
posbox:
|
||||||
|
build: ./posbox
|
||||||
|
command: -- --load=web,hw_proxy,hw_posbox_homepage,hw_escpos,hw_screen,hw_printer_network
|
||||||
|
ports:
|
||||||
|
- 8070:8069
|
||||||
|
- 8072:8072
|
||||||
|
volumes:
|
||||||
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
|
networks:
|
||||||
|
localnet:
|
||||||
|
ipv4_address: 10.5.0.3
|
||||||
|
db:
|
||||||
|
image: postgres:9.6
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=odoo
|
||||||
|
- POSTGRES_USER=odoo
|
||||||
|
- PGDATA=/var/lib/postgresql/data/pgdata
|
||||||
|
volumes:
|
||||||
|
- odoo-db-data:/var/lib/postgresql/data/pgdata
|
||||||
|
networks:
|
||||||
|
localnet:
|
||||||
|
ipv4_address: 10.5.0.4
|
||||||
|
volumes:
|
||||||
|
odoo-web-data:
|
||||||
|
odoo-db-data:
|
||||||
|
networks:
|
||||||
|
localnet:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 10.5.0.0/16
|
||||||
|
gateway: 10.5.0.1
|
17
odoo/Dockerfile
Normal file
17
odoo/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
FROM odoo:11
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y install --no-install-recommends git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& mkdir -p /opt/posbox/addons \
|
||||||
|
&& chown -R odoo.odoo /opt/posbox
|
||||||
|
|
||||||
|
USER odoo
|
||||||
|
|
||||||
|
## Get pos-addons for pos_printer_network
|
||||||
|
RUN git clone --depth=1 -b 11.0 https://github.com/it-projects-llc/pos-addons.git \
|
||||||
|
/opt/posbox/addons
|
||||||
|
|
||||||
|
COPY odoo.conf /etc/odoo/odoo.conf
|
3
odoo/odoo.conf
Normal file
3
odoo/odoo.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[options]
|
||||||
|
addons_path = /mnt/extra-addons,/opt/posbox/addons
|
||||||
|
data_dir = /var/lib/odoo
|
66
posbox/Dockerfile
Normal file
66
posbox/Dockerfile
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
FROM debian:jessie
|
||||||
|
MAINTAINER Odoo S.A. <info@odoo.com>
|
||||||
|
|
||||||
|
# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
|
||||||
|
RUN set -x; \
|
||||||
|
apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
node-clean-css \
|
||||||
|
node-less \
|
||||||
|
python-gevent \
|
||||||
|
python-netifaces \
|
||||||
|
python-pip \
|
||||||
|
python-pyinotify \
|
||||||
|
python-renderpm \
|
||||||
|
python-support \
|
||||||
|
&& curl -o wkhtmltox.deb -SL http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb \
|
||||||
|
&& echo '40e8b906de658a2221b15e4e8cd82565a47d7ee8 wkhtmltox.deb' | sha1sum -c - \
|
||||||
|
&& dpkg --force-depends -i wkhtmltox.deb \
|
||||||
|
&& apt-get -y install -f --no-install-recommends \
|
||||||
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false npm \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb \
|
||||||
|
&& pip install psycogreen==1.0
|
||||||
|
|
||||||
|
# Install Odoo
|
||||||
|
ENV ODOO_VERSION 8.0
|
||||||
|
ENV ODOO_RELEASE 20170815
|
||||||
|
RUN set -x; \
|
||||||
|
curl -o odoo.deb -SL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
|
||||||
|
&& echo '5835e966a07e5684b4f7bcc39585276b0bb68254 odoo.deb' | sha1sum -c - \
|
||||||
|
&& dpkg --force-depends -i odoo.deb \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get -y install -f --no-install-recommends \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* odoo.deb
|
||||||
|
|
||||||
|
# Copy entrypoint script and Odoo configuration file
|
||||||
|
COPY ./entrypoint.sh /
|
||||||
|
COPY ./openerp-server.conf /etc/odoo/
|
||||||
|
RUN chown odoo /etc/odoo/openerp-server.conf
|
||||||
|
|
||||||
|
# Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
|
||||||
|
RUN mkdir -p /mnt/extra-addons \
|
||||||
|
&& chown -R odoo /mnt/extra-addons
|
||||||
|
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
|
||||||
|
|
||||||
|
# Expose Odoo services
|
||||||
|
EXPOSE 8069 8071
|
||||||
|
|
||||||
|
# Set the default config file
|
||||||
|
ENV OPENERP_SERVER /etc/odoo/openerp-server.conf
|
||||||
|
|
||||||
|
## Prepare for pos-addons / hw_printer_network
|
||||||
|
RUN pip install -U pip setuptools \
|
||||||
|
&& pip install python-escpos
|
||||||
|
|
||||||
|
# hw_printer_network is located in 11.0 branch, but works with earler versions too
|
||||||
|
RUN git clone --depth=1 -b 11.0 https://github.com/it-projects-llc/pos-addons.git \
|
||||||
|
/opt/posbox/addons
|
||||||
|
|
||||||
|
# Set default user when running the container
|
||||||
|
USER odoo
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["openerp-server"]
|
42
posbox/entrypoint.sh
Executable file
42
posbox/entrypoint.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# set the postgres database host, port, user and password according to the environment
|
||||||
|
# and pass them as arguments to the odoo process if not present in the config file
|
||||||
|
: ${HOST:=${DB_PORT_5432_TCP_ADDR:='db'}}
|
||||||
|
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
||||||
|
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
||||||
|
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
|
||||||
|
|
||||||
|
DB_ARGS=()
|
||||||
|
function check_config() {
|
||||||
|
param="$1"
|
||||||
|
value="$2"
|
||||||
|
if ! grep -q -E "^\s*\b${param}\b\s*=" "$OPENERP_SERVER" ; then
|
||||||
|
DB_ARGS+=("--${param}")
|
||||||
|
DB_ARGS+=("${value}")
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
check_config "db_host" "$HOST"
|
||||||
|
check_config "db_port" "$PORT"
|
||||||
|
check_config "db_user" "$USER"
|
||||||
|
check_config "db_password" "$PASSWORD"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
-- | openerp-server)
|
||||||
|
shift
|
||||||
|
if [[ "$1" == "scaffold" ]] ; then
|
||||||
|
exec openerp-server "$@"
|
||||||
|
else
|
||||||
|
exec openerp-server "$@" "${DB_ARGS[@]}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
exec openerp-server "$@" "${DB_ARGS[@]}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exec "$@"
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 1
|
3
posbox/openerp-server.conf
Normal file
3
posbox/openerp-server.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[options]
|
||||||
|
addons_path = /opt/posbox/addons
|
||||||
|
data_dir = /var/lib/odoo
|
Reference in a new issue