Dockerfile + docker-compose add: add dev sintonia_webapp container

This commit is contained in:
Michael 2025-01-23 13:49:55 +01:00
parent ca3a179529
commit 35043d436f
3 changed files with 115 additions and 0 deletions

View File

@ -278,3 +278,84 @@ USER ${UID}:${GID}
ARG LIBRETIME_VERSION ARG LIBRETIME_VERSION
ENV LIBRETIME_VERSION=$LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION
#======================================================================================#
# Sintonia #
#======================================================================================#
# Use PHP as the base
FROM php:8.2-cli AS sintonia-webapp
# Arguments defined in docker-compose-dev.yml
ARG sintonia_user=$SINTONIA_USER
ARG sintonia_uid=$SINTONIA_UID
ARG sintonia_node_version=$SINTONIA_NODE_VERSION
ARG sintonia_production=$SINTONIA_PRODUCTION
ENV sintonia_laravel_port $SINTONIA_LARAVEL_PORT
ENV sintonia_vite_port $SINTONIA_VITE_PORT
ENV DEBIAN_FRONTEND=noninteractive
# Install Additional System Dependencies and PHP Extensions
RUN set -eux && \
apt-get update -y && \
apt-get install -y --no-install-recommends \
libjpeg62-turbo-dev \
libfreetype6-dev \
libmcrypt-dev \
zlib1g-dev \
zip \
unzip \
libzip-dev \
libpng-dev \
git \
libonig-dev && \
docker-php-ext-configure zip && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install gd exif pcntl bcmath mysqli pdo_mysql mbstring && \
if [ ! "$sintonia_production" ]; then \
pecl install xdebug; docker-php-ext-enable xdebug; \
fi && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY ./sintonia_webapp /var/www/sintonia
# Create system user to run Composer and Artisan Commands
RUN set -eux && useradd -G www-data -u $sintonia_uid -d /home/$sintonia_user $sintonia_user && \
mkdir -p /home/$sintonia_user/.composer && \
mkdir -p /var/www/sintonia && \
chown -R $sintonia_user:$sintonia_user /home/$sintonia_user && \
chown -R $sintonia_user:$sintonia_user /var/www/sintonia
USER "$sintonia_user"
WORKDIR /home/$sintonia_user
# node and composer installation
# Download and install nvm:
RUN curl -fsSL https://nodejs.org/dist/v$sintonia_node_version/node-v$sintonia_node_version-linux-x64.tar.gz -o node.tar.gz && \
tar -xzvf node.tar.gz && \
rm node.tar.gz
ENV PATH="/home/$sintonia_user/node-v$sintonia_node_version-linux-x64/bin:/home/$sintonia_user/composer:${PATH}"
# Install composer
RUN set -eux && curl -sS https://getcomposer.org/installer | php -- --install-dir=/home/$sintonia_user/ --filename=composer
WORKDIR /var/www/sintonia
#Package installation
RUN git config --global --add safe.directory /var/www/sintonia && \
/home/$sintonia_user/composer install --no-progress --no-interaction --no-dev --no-autoloader && \
set -eux && \
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction --no-dev && \
npm i
##
### Start server
CMD if [ ! $sintonia_production ]; then \
cd /var/www/sintonia; \
npx vite --port $sintonia_vite_port --host & \
php artisan serve --host=0.0.0.0 --port=$sintonia_laravel_port & \
sleep infinity; \
fi;

View File

@ -66,6 +66,16 @@ services:
volumes: volumes:
- ./legacy:/var/www/html - ./legacy:/var/www/html
sintonia-webapp:
build:
context: .
target: sintonia-webapp
image: sintonia-webapp
container_name: sintonia-webapp
working_dir: /var/www/
volumes:
- libretime_storage:/srv/libretime
nginx: nginx:
volumes: volumes:
- ./legacy:/var/www/html - ./legacy:/var/www/html

View File

@ -98,6 +98,30 @@ services:
- libretime_assets:/var/www/html - libretime_assets:/var/www/html
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
sintonia-webapp:
build:
context: ./sintonia_webapp
args:
- sintonia_user=${SINTONIA_USER}
- sintonia_uid=${SINTONIA_UID}
- sintonia_node_version=${SINTONIA_NODE_VERSION}
- sintonia_production=${SINTONIA_PRODUCTION}
image: sintonia-webapp
container_name: sintonia-webapp
depends_on:
- postgres
- rabbitmq
init: true
working_dir: /var/www/
volumes:
- libretime_storage:/srv/libretime
ports:
- ${SINTONIA_LARAVEL_PORT}:${SINTONIA_LARAVEL_PORT}
- ${SINTONIA_VITE_PORT}:${SINTONIA_VITE_PORT}
environment:
- sintonia_laravel_port=${SINTONIA_LARAVEL_PORT}
- sintonia_vite_port=${SINTONIA_VITE_PORT}
nginx: nginx:
image: nginx image: nginx
ports: ports: