docker configuration

This commit is contained in:
Sieciech 2021-07-23 18:08:09 +02:00
parent 4f72c5b135
commit 9442839cc4
7 changed files with 87 additions and 19 deletions

35
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "PHP 8.0",
"type": "php",
"request": "launch",
"pathMappings": {
"/web/backend": "${workspaceFolder}\\src\\backend"
},
"skipFiles": [
"${workspaceFolder}/src/backend/vendor/**"
],
"port": 7780,
"hostname": "127.0.0.1",
"xdebugSettings": {
"max_children": 100,
}
},
{
"name": "PHP 8.0 with vendor",
"type": "php",
"request": "launch",
"pathMappings": {
"/web/backend": "${workspaceFolder}\\src\\backend"
},
"port": 7780,
"hostname": "127.0.0.1",
"xdebugSettings": {
"max_children": 100,
}
}
]
}

View File

@ -16,9 +16,9 @@ RUN apt update \
&& echo "update repos" \
&& apt update \
&& echo "install software" \
&& apt install -y aptitude nano openssh-server unzip \
&& apt install -y aptitude unzip \
&& apt install -y postgresql pgadmin4 \
&& apt install -y php8.0 php8.0-ctype php8.0-iconv php8.0-simplexml php8.0-tokenizer php8.0-fpm php8.0-pdo php8.0-pdo-pgsql php8.0-pgsql php8.0-mbstring php8.0-zip \
&& apt install -y php8.0 php8.0-ctype php8.0-iconv php8.0-simplexml php8.0-tokenizer php8.0-fpm php8.0-pdo php8.0-pdo-pgsql php8.0-pgsql php8.0-mbstring php8.0-zip php8.0-xdebug \
&& apt install -y nginx \
&& apt install -y nodejs \
&& echo "configure tools" \
@ -34,15 +34,16 @@ RUN apt update \
&& echo "# postgresql" \
&& echo "postgres:WeryStronkPaz2" | chpasswd \
&& echo "# pgadmin4" \
&& bash -c 'PGADMIN_SETUP_EMAIL="michal@fufle.net" PGADMIN_SETUP_PASSWORD="password" /usr/pgadmin4/bin/setup-web.sh --yes' \
&& bash -c 'PGADMIN_SETUP_EMAIL="admin@pgadmin.localhost" PGADMIN_SETUP_PASSWORD="WeryStronkPaz2" /usr/pgadmin4/bin/setup-web.sh --yes' \
&& echo "" > /etc/nginx/sites-enabled/default \
&& echo "!!! DONE !!!"
RUN apt install -y nano openssh-server telnet
VOLUME /web/backend/vendor
VOLUME /web/backend/var
VOLUME /web/frontend/node_modules
EXPOSE 7700
EXPOSE 7700 7780 7781
STOPSIGNAL SIGQUIT

View File

@ -1,10 +1,12 @@
version: "3.9"
services:
cureapp:
app:
build: .
ports:
- target: 7700
published: 7700
- 7700:7700
expose:
- 7780:7780
- 7781:7781
volumes:
- .:/web/config
- ../src/backend:/web/backend:cached

View File

@ -0,0 +1,12 @@
zend_extension=xdebug.so
[xdebug]
xdebug.mode=coverage
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=7781
xdebug.show_exception_trace = 1
xdebug.show_error_trace = 1
xdebug.log_level = 0

View File

@ -0,0 +1,12 @@
zend_extension=xdebug.so
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port=7780
xdebug.show_exception_trace = 1
xdebug.show_error_trace = 1
xdebug.log_level = 0

1
docker/run Normal file
View File

@ -0,0 +1 @@
docker compose -p curenet up

View File

@ -1,39 +1,44 @@
#!/bin/bash
echo Configure logs
echo "> Configure logs"
mkdir -p /var/log/{apache2,nginx,pgadmin,postgresql}
chmod root:postgres /var/log/postgresql -R
chown postgres:adm /var/log/postgresql -R
chown root:postgres /var/log/postgresql
echo Configure volumes
echo "> Configure volumes"
[ -e /web/frontend/node_modules ] || ln -s /web/node /web/frontend/node_modules
[ -e /web/backend/var ] || ln -s /web/var /web/backend/var
[ -e /web/backend/vendor ] || ln -s /web/vendor /web/backend/vendor
echo Starting php-fpm server
echo "> Starting php8.0-fpm server"
[ -e /etc/php/8.0/fpm/conf.d/20-xdebug.ini ] && rm /etc/php/8.0/fpm/conf.d/20-xdebug.ini || echo OK
[ -e /etc/php/8.0/cli/conf.d/20-xdebug.ini ] && rm /etc/php/8.0/cli/conf.d/20-xdebug.ini || echo OK
cp /web/config/php8.0/xdebug-fpm.ini /etc/php/8.0/fpm/conf.d/20-xdebug.ini
cp /web/config/php8.0/xdebug-cli.ini /etc/php/8.0/cli/conf.d/20-xdebug.ini
service php8.0-fpm start
echo Starting nginx server
echo "> Starting nginx server"
service nginx start
echo Starting apache2 server for pgAdmin4
echo "> Starting apache2 server for pgAdmin4"
service apache2 start
echo Starting postgresql database
echo "> Starting postgresql database"
service postgresql start
echo Starting ssh server
echo "> Starting ssh server"
service ssh start
echo Configure database
echo "> Configure database"
su postgres -c psql postgres < /web/config/postgres/init-data.sql
echo Configure symfony
echo "> Configure symfony"
cd /web/backend
composer install
echo Configure angular
echo "> Configure angular"
cd /web/frontend
npm i
echo Starting angular
echo "> Starting angular"
ng serve