chore: add readme for docker specifications

This commit is contained in:
Junior L. Botelho (JLB) 2023-02-12 16:05:57 -03:00
parent 2706cf3eb0
commit a0a3a904df
No known key found for this signature in database
GPG Key ID: 6A25840754F2A524
1 changed files with 82 additions and 2 deletions

View File

@ -1,5 +1,85 @@
## Introduction
The 'Dockerfile' located in the root directory will copy all Docker scripts from the current directory to the container and build them inside the 'librex:latest' container. The files inside the 'templates' directory contain variables that will be replaced by 'build.sh' with arguments from the Dockerfiles.
Dockerized Librex is a way to provide users with yet another way to self-host their own projects with a view to privacy. If you wish to help, please start by looking for bugs in used docker configurations.
- Why are 'Docker-in-Docker' containers being run in this project?
To run librex in a docker container, you can simply use the command:
```sh
docker run -d --name librex \
-e TZ="America/New_York" \
-e CONFIG_GOOGLE_DOMAIN="com" \
-e CONFIG_GOOGLE_LANGUAGUE="en" \
-p 8080:8080 \
librex/librex:latest
```
or with **`docker-compose.yml`**:
```yml
version: "2.1"
services:
librex:
image: librex/librex:latest
container_name: librex
network_mode: bridge
ports:
- 8080:8080
environment:
- PUID=1000
- PGID=1000
- VERSION=docker
- TZ="America/New_York"
- CONFIG_GOOGLE_DOMAIN="com"
- CONFIG_GOOGLE_LANGUAGUE="en"
volumes:
- ./nginx_logs:/var/log/nginx
- ./php_logs:/var/log/php7
restart: unless-stopped
```
### Docker Version
If you are going to build your own docker image based on this repository, pay attention to your Docker version, because depending on how recent the installed version is, maybe you should use the `buildx` command instead of `build`.
Docker <= 20.10: `docker build`
Docker > 20.10: `docker buildx build`
### Build
If you don't want to use the image that is already available on `docker hub`, then you can simply build the Dockerfile directly from the github repository using the command:
```sh
docker build https://github.com/hnhx/librex.git -t librex:latest
```
```sh
docker run -d --name librex \
-e CONFIG_GOOGLE_DOMAIN="com" \
-e CONFIG_GOOGLE_LANGUAGUE="en" \
-p 8080:8080 \
librex:latest
```
Or, instead of doing the build remotely, you still have the opportunity to `git clone` the repository, and build it locally with the command:
```sh
git clone https://github.com/hnhx/librex.git
cd librex/
docker build -t librex:latest .
```
### Supported Architectures
Supported architectures for the official Librex images include the same ones supported by Alpine itself, which are typically denoted as `linux/386`, `linux/amd64`, `linux/arm/v6`. If you need support for a different architecture, such as 'linux/arm/v7', you can modify the 'Dockerfile' to use a more comprehensive base image like 'ubuntu:latest' instead.
In this case, you must run the `build` process specifying the desired architecture as shown in the example below:
```sh
docker buildx build \
--no-cache \
--platform linux/arm/v7 \
--tag librex/librex:latest .
```
**OBS:** Keep in mind that this can cause some issues at build time, so you need to know a little about Dockerfiles to solve this problem for your specific case.