2020-07-28 01:37:10 -04:00
# ERPLibre - Docker
2020-09-30 20:49:35 -04:00
Those images are prepared to permit better portability and reproducibility of ERPLibre release.
2020-07-28 01:37:10 -04:00
2020-07-28 06:09:58 -04:00
Due the the growing code of ERPLibre, it could also simplify development.
2020-07-28 01:37:10 -04:00
2020-09-30 20:49:35 -04:00
NOTE: Those Dockerfiles themselves are in heavy development for now. Incompatibilities between releases are normal until the interface is stabilized.
2020-07-28 01:37:10 -04:00
2020-07-28 06:09:58 -04:00
## Pre-requirements
2020-07-28 01:37:10 -04:00
2020-07-28 06:09:58 -04:00
- Basic knowledge with Docker, Linux and bash
2020-07-28 01:37:10 -04:00
- Latest Docker version
## Files representations
2020-09-30 20:49:35 -04:00
- Dockerfile.base: This Dockerfile represents the base Docker image layer reused by other child layers.
2020-07-28 06:09:58 -04:00
- Dockerfile.dev: This Dockerfile is specialized in development.
2020-09-30 20:49:35 -04:00
- Dockerfile.prod{pkg,src}: Dockerfile.prod.\* is a Docker image specialized for production systems. Dockerfile.prod.pkg reuses official Debian files from Odoo.com. Dockerfile.prod.src fetches the Odoo source code as the ERPLibre runtime.
2020-07-28 01:37:10 -04:00
## Getting started
2020-07-28 06:09:58 -04:00
Be sure to start daemon docker
```bash
systemctl start docker
```
2020-07-28 01:37:10 -04:00
2020-07-28 06:09:58 -04:00
### Building the docker images
2020-07-28 01:37:10 -04:00
2020-07-28 06:09:58 -04:00
```bash
cd docker
docker build -f Dockerfile.base -t technolibre/erplibre-base:12.0 .
docker build -f Dockerfile.prod.pkg -t technolibre/erplibre:12.0-pkg .
```
2020-07-28 01:37:10 -04:00
### Running ERPLibre using Docker-Compose
2020-07-28 06:09:58 -04:00
Go at the root of this git project.
```bash
cd ERPLibre
2020-07-29 18:12:06 -04:00
docker-compose -f docker-compose.yml up -d
2020-07-28 06:09:58 -04:00
```
### Diagnostic Docker-Compose
Show docker-compose information
```bash
docker-compose ps
docker-compose logs IMAGE_NAME
```
Show docker information
```bash
docker ps -a
docker volume ls
docker inspect DOCKER_NAME
```
Connect to a running docker
```bash
docker exec -ti DOCKER_NAME bash
docker exec -u root -ti DOCKER_NAME bash
```
2020-09-30 20:49:35 -04:00
Commands for debugging
2020-07-28 06:09:58 -04:00
```bash
docker run -p 8069:8069 --entrypoint bash -ti DOCKER_NAME
docker exec -ti DOCKER_NAME bash
docker exec -u root -ti DOCKER_NAME bash
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=odoo -e POSTGRES_DB=postgres postgre
export
db_host = "host.docker.internal"
2020-08-02 00:10:34 -04:00
docker stats erplibre_ERPLibre_1
2020-07-28 06:09:58 -04:00
```
### Cleaning
2020-10-11 10:39:47 -04:00
Delete all system
```bash
docker system prune -a
```
2020-07-28 06:09:58 -04:00
Delete docker image
```bash
docker image prune
2020-10-11 10:39:47 -04:00
docker rmi $(docker images -q)
2020-07-28 06:09:58 -04:00
```
Delete volumes
```bash
docker-compose rm -v
```
Delete containers
```bash
docker rm $(docker ps -a | grep -v IMAGE | awk '{print $1}')
```
Delete volume
```bash
docker volume prune
```
2020-07-29 18:12:06 -04:00
2020-09-30 20:49:35 -04:00
# Change docker directory
You can change the docker directory by editing file `/etc/docker/daemon.json`
2020-07-29 18:12:06 -04:00
```json
{
"data-root": "/home/docker"
}
```
2020-09-30 20:49:35 -04:00
And restart docker service. You can delete or move all older locations of docker.
2020-08-10 15:52:51 -04:00
# Update docker
When building your docker with script
2021-06-30 22:26:20 -04:00
> make docker_build
2020-08-10 15:52:51 -04:00
2020-10-03 01:36:29 -04:00
List your docker version
2021-06-30 22:26:20 -04:00
> docker images
2020-10-03 01:36:29 -04:00
2020-08-10 15:52:51 -04:00
You need to push your docker image and update your tag, like 1.0.1:
2020-10-03 01:36:29 -04:00
> docker push technolibre/erplibre:VERSION