Add docker deployment
All checks were successful
build docker image / docker-build (push) Successful in 1m40s

This commit is contained in:
Illya Marchenko 2024-11-04 18:07:51 +02:00
parent ed38c8ed64
commit 13f81622db
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F
2 changed files with 18 additions and 10 deletions

View File

@ -68,14 +68,20 @@ RUN docker-php-ext-install \
pdo_sqlite \
bcmath
# Configure PHP
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
# Configure php-fpm
RUN sed -i 's/listen = 127.0.0.1:9000/listen = \/run\/php\/php-fpm.sock/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.owner = www-data/listen.owner = www-data/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.group = www-data/listen.group = www-data/' /usr/local/etc/php-fpm.d/www.conf \
&& sed -i 's/;listen.mode = 0660/listen.mode = 0660/' /usr/local/etc/php-fpm.d/www.conf \
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
&& sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/' /usr/local/etc/php/php.ini \
&& sed -i 's/post_max_size = 8M/post_max_size = 200M/' /usr/local/etc/php/php.ini
# Install Node.js
RUN npm install -g n && n 18
# Apply configs
COPY ./docker/conf/* /
COPY ./docker/conf/etc /etc
# Configure project
WORKDIR /tmp
@ -86,7 +92,9 @@ COPY . .
RUN npm install \
&& npm run build \
&& chown www-data:www-data . -R \
&& mv /tmp/dist/* /tmp/api /var/www/html
&& rm -r /var/www/html/* \
&& mv /tmp/dist/* /tmp/api /var/www/html \
&& rm -r /tmp/*
WORKDIR /var/www/html

View File

@ -3,17 +3,17 @@ server {
server_name default;
root /var/www/html;
index index.php;
index index.html;
client_max_body_size 5m;
client_body_timeout 60;
location / {
try_files $uri $uri/ @rewrite;
}
try_files $uri $uri/ /index.html;
location @rewrite {
rewrite ^/(.*)$ /index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.html last;
}
}
location ~ \.php$ {
@ -23,7 +23,7 @@ server {
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri /index.php;
try_files $uri /index.html;
expires max;
log_not_found off;
}