docker: Working on mysql database and symfony dependencies
This commit is contained in:
parent
1654885838
commit
d8ca495471
|
@ -1,10 +1,7 @@
|
||||||
var
|
/var
|
||||||
.venv
|
/.venv
|
||||||
.github
|
/.github
|
||||||
.ideas
|
/.ideas
|
||||||
media
|
/media
|
||||||
daemon/systemd
|
/daemon/systemd
|
||||||
analyzer
|
/analyzer
|
||||||
vendor
|
|
||||||
node_modules
|
|
||||||
build
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ CUDA_VISIBLE_DEVICES=""
|
||||||
DATABASE_USER="birdnet"
|
DATABASE_USER="birdnet"
|
||||||
DATABASE_PASSWORD="secret" # change this
|
DATABASE_PASSWORD="secret" # change this
|
||||||
DATABASE_PORT="3306"
|
DATABASE_PORT="3306"
|
||||||
MYSQL_ROOT_PASSWORD="secret" # change this
|
DATABASE_ROOT_PASSWORD="secret" # change this
|
||||||
|
|
||||||
RECORDS_DIR="/media/data/birdnet/records"
|
RECORDS_DIR="/media/data/birdnet/records"
|
||||||
CHARTS_DIR="/media/data/birdnet/charts"
|
CHARTS_DIR="/media/data/birdnet/charts"
|
||||||
|
|
|
@ -27,7 +27,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- ${DATABASE_PORT:-3306}:3306
|
- ${DATABASE_PORT:-3306}:3306
|
||||||
networks:
|
networks:
|
||||||
birdnet_network:
|
- birdnet_network
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:-secret}'
|
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:-secret}'
|
||||||
MYSQL_USER: ${DATABASE_USER:-birdnet}
|
MYSQL_USER: ${DATABASE_USER:-birdnet}
|
||||||
|
@ -38,11 +38,16 @@ services:
|
||||||
|
|
||||||
php-fpm:
|
php-fpm:
|
||||||
container_name: birdnet_php-fpm
|
container_name: birdnet_php-fpm
|
||||||
image: php:${PHP_VERSION:-8.1}-fpm
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./docker/php-fpm/Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- '9000:9000'
|
- '${PHP_FPM_PORT:-9000}:9000'
|
||||||
networks:
|
networks:
|
||||||
birdnet_network:
|
- birdnet_network
|
||||||
|
environment:
|
||||||
|
- APP_ENV=${APP_ENV:-prod}
|
||||||
|
- APP_DEBUG=${APP_DEBUG:-true}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- birdnet_app:${PROJECT_ROOT:-/opt/birdnet}
|
- birdnet_app:${PROJECT_ROOT:-/opt/birdnet}
|
||||||
|
@ -50,21 +55,22 @@ services:
|
||||||
symfony:
|
symfony:
|
||||||
container_name: birdnet_symfony
|
container_name: birdnet_symfony
|
||||||
networks:
|
networks:
|
||||||
birdnet_network:
|
- birdnet_network
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./docker/symfony/Dockerfile
|
dockerfile: ./docker/symfony/Dockerfile
|
||||||
environment:
|
args:
|
||||||
- DATABASE_DEFAULT_URL=${DATABASE_DEFAULT_URL:-mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-db}:3306/birdnet_default}
|
- DATABASE_DEFAULT_URL=mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-birdnet_database}:${DATABASE_PORT:-3306}/birdnet_default
|
||||||
- DATABASE_OBSERVATION_URL=${DATABASE_OBSERVATION_URL:-mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-db}:3306/birdnet_observation}
|
- DATABASE_OBSERVATIONS_URL=mysql://${DATABASE_USER:-birdnet}:${DATABASE_PASSWORD:-secret}@${DATABASE_HOST:-birdnet_database}:${DATABASE_PORT:-3306}/birdnet_observation
|
||||||
- RECORDS_DIR=/media/birdnet/records
|
- RECORDS_DIR=/media/birdnet/records
|
||||||
|
- CHARTS_DIR=/media/birdnet/charts
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
volumes:
|
volumes:
|
||||||
- birdnet_app:${PROJECT_ROOT:-/opt/birdnet}
|
- birdnet_app:${PROJECT_ROOT:-/opt/birdnet}
|
||||||
- birdnet_records:${RECORDS_DIR:-/media/birdnet/records}
|
- birdnet_records:${RECORDS_DIR:-/media/birdnet/records}
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
container_name: birdnet_nginx
|
container_name: birdnet_nginx
|
||||||
hostname: ${SERVER_NAME:-birdnet.local}
|
hostname: ${SERVER_NAME:-birdnet.local}
|
||||||
|
@ -76,11 +82,11 @@ services:
|
||||||
- SYMFONY_PUBLIC=/opt/birdnet/www/public
|
- SYMFONY_PUBLIC=/opt/birdnet/www/public
|
||||||
- CHARTS_DIR=/media/birdnet/charts
|
- CHARTS_DIR=/media/birdnet/charts
|
||||||
- RECORDS_DIR=/media/birdnet/records
|
- RECORDS_DIR=/media/birdnet/records
|
||||||
- PHP_FPM_HOST=php-fpm
|
- PHP_FPM_HOST=birdnet_php-fpm
|
||||||
- PHP_FPM_PORT=9000
|
- PHP_FPM_PORT=9000
|
||||||
ports:
|
ports:
|
||||||
- '80:80'
|
- '81:80'
|
||||||
- '443:443'
|
- '444:443'
|
||||||
volumes:
|
volumes:
|
||||||
- birdnet_app:/opt/birdnet
|
- birdnet_app:/opt/birdnet
|
||||||
- birdnet_records:/media/data/records
|
- birdnet_records:/media/data/records
|
||||||
|
@ -96,6 +102,7 @@ services:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
birdnet_network:
|
birdnet_network:
|
||||||
|
driver: bridge
|
||||||
ipam:
|
ipam:
|
||||||
config:
|
config:
|
||||||
- subnet: ${IP_SUBNET:-172.25.0.0/24}
|
- subnet: ${IP_SUBNET:-172.25.0.0/24}
|
||||||
|
@ -107,4 +114,4 @@ volumes:
|
||||||
driver_opts:
|
driver_opts:
|
||||||
type: none
|
type: none
|
||||||
device: ${RECORDS_DIR:-/media/data/records}
|
device: ${RECORDS_DIR:-/media/data/records}
|
||||||
o: bind
|
o: bind
|
||||||
|
|
|
@ -3,6 +3,6 @@ ARG PHP_VERSION=${PHP_VERSION:-8.1}
|
||||||
FROM php:${PHP_VERSION}-fpm
|
FROM php:${PHP_VERSION}-fpm
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y
|
RUN apt-get update && apt-get upgrade -y
|
||||||
RUN docker-php-ext-install pdo_mysql
|
RUN docker-php-ext-install pdo pdo_mysql
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
|
@ -2,39 +2,74 @@ ARG PHP_VERSION=${PHP_VERSION:-8.1}
|
||||||
|
|
||||||
FROM php:${PHP_VERSION}
|
FROM php:${PHP_VERSION}
|
||||||
|
|
||||||
ARG PROJECT_ROOT=${PROJECT_ROOT:-/opt/birdnet}
|
ARG PROJECT_ROOT
|
||||||
ARG NODE_VERSION=${NODE_VERSION:-16.17.0}
|
ARG NODE_VERSION
|
||||||
|
ARG RECORDS_DIR
|
||||||
|
ARG CHARTS_DIR
|
||||||
|
ARG DATABASE_DEFAULT_URL
|
||||||
|
ARG DATABASE_OBSERVATIONS_URL
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y \
|
ENV PHP_VERSION=${PHP_VERSION:-8.1} \
|
||||||
&& apt-get install -y \
|
NODE_VERSION=${NODE_VERSION:-16.17.0} \
|
||||||
curl \
|
PROJECT_ROOT=${PROJECT_ROOT:-/opt/birdnet} \
|
||||||
gzip \
|
RECORDS_DIR=${RECORDS_DIR:-/media/data/birdnet/records} \
|
||||||
git \
|
CHARTS_DIR=${CHARTS_DIR:-/media/data/birdnet/charts} \
|
||||||
vim \
|
DATABASE_DEFAULT_URL=${DATABASE_DEFAULT_URL:-mysql://birdnet:secret@birdnet_database/birdnet} \
|
||||||
&& apt-get clean
|
DATABASE_OBSERVATIONS_URL=${DATABASE_OBSERVATIONS_URL:-mysql://birdnet:secret@birdnet_database/birdnet_observations}
|
||||||
|
|
||||||
# Install composer
|
ENV APP_ENV=${APP_ENV:-prod}
|
||||||
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
ENV APP_DEBUG=${APP_DEBUG:-0}
|
||||||
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
|
||||||
|
|
||||||
# Install nodejs and npm
|
# RUN apt-get update && apt-get upgrade -y \
|
||||||
ENV NVM_DIR="/usr/local/nvm"
|
# && apt-get install -y \
|
||||||
RUN mkdir ${NVM_DIR}
|
# curl \
|
||||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
|
# zip \
|
||||||
RUN . "$NVM_DIR/nvm.sh" \
|
# unzip \
|
||||||
&& nvm install ${NODE_VERSION} \
|
# zlib1g-dev \
|
||||||
&& nvm use ${NODE_VERSION} \
|
# libzip-dev \
|
||||||
&& nvm alias default ${NODE_VERSION} \
|
# git \
|
||||||
&& npm install -g yarn
|
# vim \
|
||||||
ENV PATH="$PATH:/usr/local/nvm/versions/node/v${NODE_VERSION}/bin"
|
# && apt-get clean
|
||||||
|
|
||||||
|
# RUN docker-php-ext-install zip pdo_mysql
|
||||||
|
|
||||||
|
# # Install composer
|
||||||
|
# RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||||||
|
# && php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|
||||||
|
# # Install nodejs and npm
|
||||||
|
# ENV NVM_DIR="/usr/local/nvm"
|
||||||
|
# RUN mkdir ${NVM_DIR}
|
||||||
|
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
|
||||||
|
# RUN . "$NVM_DIR/nvm.sh" \
|
||||||
|
# && nvm install ${NODE_VERSION} \
|
||||||
|
# && nvm use ${NODE_VERSION} \
|
||||||
|
# && nvm alias default ${NODE_VERSION} \
|
||||||
|
# && npm install -g yarn
|
||||||
|
# ENV PATH="$PATH:/usr/local/nvm/versions/node/v${NODE_VERSION}/bin"
|
||||||
|
|
||||||
|
# Change permissions for the home folder of www-data (used for composer cache)
|
||||||
|
RUN chown -R www-data:www-data /var/www
|
||||||
COPY . ${PROJECT_ROOT}
|
COPY . ${PROJECT_ROOT}
|
||||||
RUN chown -R www-data:www-data "${PROJECT_ROOT}"
|
|
||||||
WORKDIR ${PROJECT_ROOT}/www
|
WORKDIR ${PROJECT_ROOT}/www
|
||||||
USER www-data
|
RUN rm -rf {vendor,node_modules}
|
||||||
# Install composer packages
|
RUN chown -R www-data:www-data .
|
||||||
RUN composer install
|
|
||||||
# Install yarn dependencies
|
|
||||||
RUN . "$NVM_DIR/nvm.sh" && yarn install && yarn build
|
|
||||||
|
|
||||||
CMD ["bash"]
|
USER www-data
|
||||||
|
# Setup .env
|
||||||
|
RUN cp .env.local.example .env.local
|
||||||
|
RUN sed -i "s/^APP_ENV=.*/APP_ENV=prod/g" .env.local \
|
||||||
|
&& sed -i "s/^APP_DEBUG=.*/APP_DEBUG=0/g" .env.local \
|
||||||
|
&& sed -i "s/^APP_SECRET=.*/APP_SECRET=${APP_SECRET}/g" .env.local \
|
||||||
|
&& sed -i "s|^DATABASE_DEFAULT_URL=.*|DATABASE_DEFAULT_URL=${DATABASE_DEFAULT_URL}|g" .env.local \
|
||||||
|
&& sed -i "s|^DATABASE_OBSERVATIONS_URL=.*|DATABASE_OBSERVATIONS_URL=${DATABASE_OBSERVATIONS_URL}|g" .env.local \
|
||||||
|
&& sed -i "s|^RECORDS_DIR=.*|RECORDS_DIR=${RECORDS_DIR}|g" .env.local \
|
||||||
|
&& sed -i "s|^CHARTS_DIR=.*|CHARTS_DIR=${CHARTS_DIR}|g" .env.local
|
||||||
|
|
||||||
|
# # # Install yarn dependencies
|
||||||
|
# RUN . "$NVM_DIR/nvm.sh" && yarn install && yarn build
|
||||||
|
|
||||||
|
# # Install composer dependencies
|
||||||
|
# RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
|
# RUN composer dump-env prod
|
||||||
|
# RUN composer dump-autoload
|
|
@ -174,26 +174,27 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/collections",
|
"name": "doctrine/collections",
|
||||||
"version": "1.6.8",
|
"version": "1.7.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/collections.git",
|
"url": "https://github.com/doctrine/collections.git",
|
||||||
"reference": "1958a744696c6bb3bb0d28db2611dc11610e78af"
|
"reference": "07d15c8a766e664ec271ae84e5dfc597aeeb03b1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/collections/zipball/1958a744696c6bb3bb0d28db2611dc11610e78af",
|
"url": "https://api.github.com/repos/doctrine/collections/zipball/07d15c8a766e664ec271ae84e5dfc597aeeb03b1",
|
||||||
"reference": "1958a744696c6bb3bb0d28db2611dc11610e78af",
|
"reference": "07d15c8a766e664ec271ae84e5dfc597aeeb03b1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"doctrine/deprecations": "^0.5.3 || ^1",
|
||||||
"php": "^7.1.3 || ^8.0"
|
"php": "^7.1.3 || ^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/coding-standard": "^9.0",
|
"doctrine/coding-standard": "^9.0",
|
||||||
"phpstan/phpstan": "^0.12",
|
"phpstan/phpstan": "^1.4.8",
|
||||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5",
|
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5",
|
||||||
"vimeo/psalm": "^4.2.1"
|
"vimeo/psalm": "^4.22"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -237,22 +238,22 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/collections/issues",
|
"issues": "https://github.com/doctrine/collections/issues",
|
||||||
"source": "https://github.com/doctrine/collections/tree/1.6.8"
|
"source": "https://github.com/doctrine/collections/tree/1.7.0"
|
||||||
},
|
},
|
||||||
"time": "2021-08-10T18:51:53+00:00"
|
"time": "2022-08-18T05:44:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/common",
|
"name": "doctrine/common",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/common.git",
|
"url": "https://github.com/doctrine/common.git",
|
||||||
"reference": "c824e95d4c83b7102d8bc60595445a6f7d540f96"
|
"reference": "6a76bd25b1030d35d6ba2bf2f69ca858a41fc580"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/common/zipball/c824e95d4c83b7102d8bc60595445a6f7d540f96",
|
"url": "https://api.github.com/repos/doctrine/common/zipball/6a76bd25b1030d35d6ba2bf2f69ca858a41fc580",
|
||||||
"reference": "c824e95d4c83b7102d8bc60595445a6f7d540f96",
|
"reference": "6a76bd25b1030d35d6ba2bf2f69ca858a41fc580",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -261,6 +262,7 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/coding-standard": "^9.0",
|
"doctrine/coding-standard": "^9.0",
|
||||||
|
"doctrine/collections": "^1",
|
||||||
"phpstan/phpstan": "^1.4.1",
|
"phpstan/phpstan": "^1.4.1",
|
||||||
"phpstan/phpstan-phpunit": "^1",
|
"phpstan/phpstan-phpunit": "^1",
|
||||||
"phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0",
|
"phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0",
|
||||||
|
@ -313,7 +315,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/common/issues",
|
"issues": "https://github.com/doctrine/common/issues",
|
||||||
"source": "https://github.com/doctrine/common/tree/3.3.0"
|
"source": "https://github.com/doctrine/common/tree/3.3.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -329,20 +331,20 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-02-05T18:28:51+00:00"
|
"time": "2022-08-20T10:48:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/dbal",
|
"name": "doctrine/dbal",
|
||||||
"version": "3.4.0",
|
"version": "3.4.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/dbal.git",
|
"url": "https://github.com/doctrine/dbal.git",
|
||||||
"reference": "118a360e9437e88d49024f36283c8bcbd76105f5"
|
"reference": "22de295f10edbe00df74f517612f1fbd711131e2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/118a360e9437e88d49024f36283c8bcbd76105f5",
|
"url": "https://api.github.com/repos/doctrine/dbal/zipball/22de295f10edbe00df74f517612f1fbd711131e2",
|
||||||
"reference": "118a360e9437e88d49024f36283c8bcbd76105f5",
|
"reference": "22de295f10edbe00df74f517612f1fbd711131e2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -424,7 +426,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/doctrine/dbal/issues",
|
"issues": "https://github.com/doctrine/dbal/issues",
|
||||||
"source": "https://github.com/doctrine/dbal/tree/3.4.0"
|
"source": "https://github.com/doctrine/dbal/tree/3.4.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -440,7 +442,7 @@
|
||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-08-06T20:35:57+00:00"
|
"time": "2022-08-21T14:21:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/deprecations",
|
"name": "doctrine/deprecations",
|
||||||
|
|
Loading…
Reference in New Issue