Hi Everyone, if I want to create a docker-compose to install Invoiceplane on my server, how can I make it? I didn’t find any container in the Docker hub.
Any Help to create it?
This one:
and this one:
GitHub - 1twitif/docker-invoicePlane: ready to use invoicePlane docker-compose container are older docker-compose setups. You need to change something in the Dockerfile to get the latest InvoicePlane version.
It uses Apache as a server (and MySQL 5.5)
those 2 links belong together (sortof)
If you want to do it right, I would fork this one:
It uses nginx as a server
Every piece in the docker-compose file, I would fork it and make the correct version
It’s a little more work, but you’ll get a better result
Thank you for your answer, but what should i do if i want to create my Image? because i have done a lot of changes and i want to keep them and use my version of Invoiceplane
oh man…
First let me answer your question.
With your own image you will add a Dockerfile to your own repository.
Take a really close look at how sameersbn did it. He actually created 3 images, one of them was for invoiceplane
.
It’s what you want as well.
Now… in your docker-compose you will bring all those things together.
You will need a php-fpm image, you will need a MySQL image and you will need your own image with your personal repository.
Don’t copy/paste below, it’s just an example:
docker-compose.yml
db: | |
---|---|
image: mysql:5.7 | |
environment: | |
- MYSQL_DATABASE=invoiceplanel | |
- MYSQL_ROOT_PASSWORD=secret | |
web: | |
image: yourname/yourimageondockerhub |
or apply a local image, so you don’t need to push it to dockerhub
||links:|
||- db:db|
||ports:|
||- 8000:80|
||volumes:|
||- ~/your/path/to/invoiceplane
Below dockerfile mixes nginx with PHP, so then all you need is MySQL as separate image
Dockerfile (in your repo)
FROM something-simple-like-alpine-with-nginx
ENV PHP_VERSION=7.4
INVOICEPLANE_USER=www-data
INVOICEPLANE_INSTALL_DIR=/var/www/invoiceplane
INVOICEPLANE_DATA_DIR=/var/lib/invoiceplane
INVOICEPLANE_CACHE_DIR=/etc/docker-invoiceplane
ENV INVOICEPLANE_BUILD_DIR=${INVOICEPLANE_CACHE_DIR}/build
INVOICEPLANE_RUNTIME_DIR=${INVOICEPLANE_CACHE_DIR}/runtime
RUN apt-get update
&& DEBIAN_FRONTEND=noninteractive apt-get install -y wget sudo unzip
php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-mysql
php${PHP_VERSION}-gd php${PHP_VERSION}-json php${PHP_VERSION}-mbstring
php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc
mysql-client nginx gettext-base git
&& sed -i 's/^listen = ./listen = 0.0.0.0:9000/’ /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
&& rm -rf /var/lib/apt/lists/
COPY assets/build/ ${INVOICEPLANE_BUILD_DIR}/
COPY assets/runtime/ ${INVOICEPLANE_RUNTIME_DIR}/
COPY assets/tools/ /usr/bin/
COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh
WORKDIR /var/www/invoiceplane
ENTRYPOINT ["/sbin/entrypoint.sh"]
EXPOSE 80/tcp 9000/tcp
Keel looking at how sameersbn did it, it’s a good example.
Your docker-compose.yml tells what’s going to happen: start up MySQL and start up your local image
you invented with your Dockerfile
The base for your docker-compose.yml file is here: docker-invoiceplane/docker-compose.yml at master · sameersbn/docker-invoiceplane · GitHub
just replace where it says image: sameersbn/invoiceplane:1.5.9-3
with something else
Also, if you do build: .
instead of that image it will look at your Dockerfile in your local directory. That’s what you want.
Now… let me ask you a question:
Which changes have you made and would you like them back in the main InvoicePlane repository?
I have done the following things:
The Docekr-Compose File:
services:
database:
image: mariadb:latest
environment:
- MYSQL_USER=mohamad
- MYSQL_PASSWORD=invoice
- MYSQL_DATABASE=invoice_plane_wp
ports:
- “3306:3306”
networks:
- invoice-network
php:
image: php:7.2-fpm
volumes:
- ./code:/code
networks:
- invoice-network
environment:
- DB_HOSTNAME=database
- DB_USERNAME=mohamad
- DB_PASSWORD=invoice
- DB_DATABASE=invoice_plane_wp
- DB_PORT=3306
links:
- database
web:
image: nginx:latest
ports:
- “8080:80”
volumes:
- ./code:/code
- ./invoice.conf:/etc/nginx/conf.d/default.conf
networks:
- invoice-network
links:
- php
networks:
invoice-network:
driver: bridge
and now in the ipconfig.php i set the Database to empty like the Following:
DB_HOSTNAME=
DB_USERNAME=
DB_PASSWORD=
DB_DATABASE=
DB_PORT=
but after doing all that i see the following Error
"
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysqli_init()
Filename: /code/vendor/codeigniter/framework/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
File: /code/application/third_party/MX/Loader.php
Line: 180
Function: DB
File: /code/application/core/Base_Controller.php
Line: 56
Function: database
File: /code/application/core/User_Controller.php
Line: 29
Function: __construct
File: /code/application/core/Admin_Controller.php
Line: 26
Function: __construct
File: /code/index.php
Line: 325
Function: require_once
"
I know that Im very close to the Correct solution but i don’t know why it’s showing that error and not able to connent to the DB
I have made the Following things:
i have added an Counter for the Products Quantity so if you sold a Product will automaticly change the Quantity of that Product and if you have no remaining quantity then you will get an Alert that there is no more Quantity
It’s either not finding the mysqli driver on your nginx image or It’s missing something else.
You did great with your docker-compose.yml file. My compliments.
Now… do you see that web
service? It’s grabbing a default image from dockerhub: nginx:latest
that will never have a mysqli driver.
Same goes for the php-fpm service
Actually… maybe it should be in the php-fpm service…
Take a look at this file:
See the Dockerfile as the decorator for your default image that you’re grabbing from dockerhub.
You’re basically saying:
i want default php-fpm, but I need the following extra stuff
Make at least a Dockerfile and at least the following in it:
RUN apt-get update
&& DEBIAN_FRONTEND=noninteractive apt-get install -y wget sudo unzip
php${PHP_VERSION}-fpm php${PHP_VERSION}-cli php${PHP_VERSION}-mysql
php${PHP_VERSION}-gd php${PHP_VERSION}-json php${PHP_VERSION}-mbstring
php${PHP_VERSION}-recode php${PHP_VERSION}-xmlrpc
mysql-client nginx gettext-base git
&& sed -i 's/^listen = ./listen = 0.0.0.0:9000/’ /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
&& rm -rf /var/lib/apt/lists/
Personally I think your php-fpm service should have build .
Then in the Dockerfile the base image will be FROM php:7.2-fpm
(correct my syntax please, I might be off a tad)
Oh and PM the url to your repository of your improvements for the stock counting please, I’ll take a look