2022-08-22 06:22:30 +02:00
|
|
|
ARG PHP_VERSION=${PHP_VERSION:-8.1}
|
2022-08-22 18:49:40 +02:00
|
|
|
|
2022-08-22 06:22:30 +02:00
|
|
|
FROM php:${PHP_VERSION}
|
2022-08-22 18:49:40 +02:00
|
|
|
|
|
|
|
ARG PROJECT_ROOT=${PROJECT_ROOT:-/opt/birdnet}
|
|
|
|
ARG NODE_VERSION=${NODE_VERSION:-16.17.0}
|
2022-08-22 06:22:30 +02:00
|
|
|
|
|
|
|
RUN apt-get update && apt-get upgrade -y \
|
|
|
|
&& apt-get install -y \
|
|
|
|
curl \
|
|
|
|
gzip \
|
|
|
|
git \
|
|
|
|
vim \
|
|
|
|
&& apt-get clean
|
|
|
|
|
|
|
|
# Install composer
|
|
|
|
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
|
|
|
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
|
|
|
|
2022-08-22 18:49:40 +02:00
|
|
|
# Install nodejs and npm
|
2022-08-22 06:22:30 +02:00
|
|
|
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"
|
|
|
|
|
2022-08-22 18:49:40 +02:00
|
|
|
COPY . ${PROJECT_ROOT}
|
2022-08-22 06:22:30 +02:00
|
|
|
RUN chown -R www-data:www-data "${PROJECT_ROOT}"
|
|
|
|
WORKDIR ${PROJECT_ROOT}/www
|
2022-08-22 18:49:40 +02:00
|
|
|
USER www-data
|
|
|
|
# Install composer packages
|
2022-08-22 06:22:30 +02:00
|
|
|
RUN composer install
|
|
|
|
# Install yarn dependencies
|
|
|
|
RUN . "$NVM_DIR/nvm.sh" && yarn install && yarn build
|
|
|
|
|
2022-08-22 18:49:40 +02:00
|
|
|
CMD ["bash"]
|