-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
682d988
commit 809e759
Showing
10 changed files
with
217 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# GLPI docker devcontainers | ||
|
||
The docker devcontainers are meant to be used by VSCode or in a Github Codespaces environment. | ||
|
||
## Services ports | ||
|
||
By default, the following ports are exposed: | ||
- `8080` for the GLPI web server, | ||
- `8025` for the Mailpit web server, | ||
- `8090` for the Adminer web server. | ||
|
||
You can customize these ports by creating a `.devcontainer/docker-compose.override.yaml` file. | ||
|
||
```yaml | ||
services: | ||
app: | ||
ports: !override | ||
- "9000:80" | ||
mailpit: | ||
ports: !override | ||
- "9025:8025" | ||
adminer: | ||
ports: !override | ||
- "9080:8080" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb | ||
{ | ||
"name": "GLPI docker devcontainer", | ||
"dockerComposeFile": "docker-compose.yaml", | ||
"service": "app", | ||
"workspaceFolder": "/var/www/glpi", | ||
|
||
"forwardPorts": [8080, 8090, 8025], | ||
"portsAttributes": { | ||
"8080": { | ||
"label": "GLPI" | ||
}, | ||
"8090": { | ||
"label": "Adminer" | ||
}, | ||
"8025": { | ||
"label": "Mailpit" | ||
} | ||
}, | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "composer build", | ||
|
||
// automatically install these extensions when opening the dev container in vscode | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"bmewburn.vscode-intelephense-client", | ||
"xdebug.php-debug", | ||
"mblode.twig-language-2", | ||
"dbaeumer.vscode-eslint" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
services: | ||
app: | ||
container_name: "glpi-app" | ||
build: | ||
context: "../.docker/app" | ||
restart: "unless-stopped" | ||
volumes: | ||
- "..:/var/www/glpi:rw" | ||
ports: | ||
- "8080:80" | ||
depends_on: | ||
- db | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
|
||
db: | ||
container_name: "glpi-db" | ||
image: "mariadb:11.4" | ||
restart: "unless-stopped" | ||
volumes: | ||
- "db:/var/lib/mysql" | ||
- "./initdb.sql:/docker-entrypoint-initdb.d/initdb.sql" | ||
environment: | ||
MARIADB_ROOT_PASSWORD: "glpi" | ||
MARIADB_DATABASE: "glpi" | ||
MARIADB_USER: "glpi" | ||
MARIADB_PASSWORD: "glpi" | ||
expose: | ||
- "3306" | ||
|
||
mailpit: | ||
container_name: "glpi-mailpit" | ||
image: "axllent/mailpit" | ||
restart: "unless-stopped" | ||
expose: | ||
- "1025" | ||
ports: | ||
- "8025:8025" | ||
|
||
adminer: | ||
container_name: "glpi-adminer" | ||
image: "adminer:latest" | ||
restart: "unless-stopped" | ||
ports: | ||
- "8090:8080" | ||
environment: | ||
- "ADMINER_DEFAULT_SERVER=db" | ||
command: ["php", "-S", "0.0.0.0:8080", "-t", "/var/www/html"] | ||
|
||
volumes: | ||
db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This SQL queries contained in this file will be executed on every database container startup. | ||
|
||
# Required for timezones usage. | ||
# This may be executed before automatic `glpi` user creation, so we have to create it manually. | ||
CREATE USER IF NOT EXISTS 'glpi'@'%' IDENTIFIED BY 'glpi'; | ||
SET PASSWORD FOR 'glpi'@'%' = PASSWORD('glpi'); | ||
GRANT SELECT ON `mysql`.`time_zone_name` TO 'glpi'@'%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# GLPI docker development environment | ||
|
||
The docker development environment can be easilly instanciated by running the command `docker compose up -d` | ||
from the GLPI root directory. | ||
|
||
## Custom configuration | ||
|
||
You can customize the docker services by creating a `docker-compose.override.yaml` file in the GLPI root directory. | ||
|
||
## HTTP server | ||
|
||
By default, the HTTP port is published to on the `8080` port on the host machine. | ||
You can change it in the `docker-compose.override.yaml` file. | ||
|
||
```yaml | ||
services: | ||
app: | ||
ports: !override | ||
- "9000:80" | ||
``` | ||
The default uid/gid used by the docker container is `1000`. If your host user uses different uid/gid, you may encounter | ||
file permissions issues. To prevent this, you can customize them using the corresponding build args in | ||
the `docker-compose.override.yaml` file. | ||
|
||
```yaml | ||
services: | ||
app: | ||
build: | ||
args: | ||
HOST_GROUP_ID: "${HOST_GROUP_ID:-1000}" | ||
HOST_USER_ID: "${HOST_USER_ID:-1000}" | ||
``` | ||
|
||
### Database server | ||
|
||
By default, the database service is not provided. You can add it in the `docker-compose.override.yaml` file. | ||
|
||
```yaml | ||
services: | ||
database: | ||
container_name: "db" | ||
image: "mariadb:11.0" | ||
restart: "unless-stopped" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: "R00tP4ssw0rd" | ||
MYSQL_DATABASE: "glpi" | ||
MYSQL_USER: "glpi" | ||
MYSQL_PASSWORD: "P4ssw0rd" | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- "db:/var/lib/mysql" | ||
volumes: | ||
db: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ghcr.io/glpi-project/glpi-development-env:latest | ||
|
||
USER root | ||
|
||
# Workaround to make apache use same UID/GID as host user. | ||
ARG HOST_GROUP_ID=1000 | ||
RUN groupmod --gid ${HOST_GROUP_ID} www-data | ||
ARG HOST_USER_ID=1000 | ||
RUN usermod --uid ${HOST_USER_ID} www-data | ||
|
||
# Allow login as www-data user and allow it to execute sudo | ||
RUN usermod --shell /bin/bash www-data | ||
RUN echo "www-data ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Make www-data user home persistent for cache purpose. | ||
RUN mkdir --parents /home/www-data \ | ||
&& chown www-data:www-data /home/www-data \ | ||
&& usermod --home /home/www-data www-data | ||
VOLUME /home/www-data | ||
|
||
USER www-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
app: | ||
container_name: "glpi" | ||
build: | ||
context: ".docker/app" | ||
restart: "unless-stopped" | ||
volumes: | ||
- ".:/var/www/glpi:rw" | ||
ports: | ||
- "8080:80" | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters