Dockerfile + docker-compose add: add dev sintonia_webapp container
This commit is contained in:
parent
ca3a179529
commit
35043d436f
3 changed files with 115 additions and 0 deletions
81
Dockerfile
81
Dockerfile
|
@ -278,3 +278,84 @@ USER ${UID}:${GID}
|
|||
|
||||
ARG 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue