Skip to content

Commit

Permalink
add php images
Browse files Browse the repository at this point in the history
  • Loading branch information
vladyslav2 committed Jul 9, 2024
1 parent 3bd05bd commit e0abfa6
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
45 changes: 45 additions & 0 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM php:8.2-fpm

RUN apt-get update && apt-get install -y \
libfreetype-dev \
libjpeg62-turbo-dev \
libpng-dev \
procps \
vim \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo_mysql -j$(nproc) gd

# RUN addgroup -S www-data && adduser -S www-data -G www-data
# USER www-data

WORKDIR /var/www/html

# set development config
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN sed -i 's/;session.save_path = "\/tmp"/session.save_path = "\/var\/www\/sessions"/g' "$PHP_INI_DIR/php.ini"

# Save log to file
RUN sed -i 's/;error_log = log\/php-fpm.log/error_log = \/var\/www\/logs\/php-fpm.log/g' "$PHP_INI_DIR/../php-fpm.conf"

# Configurate php-fpm to run on socket instead of tcp
RUN sed -i 's/listen = 127.0.0.1:9000/listen = \/var\/run\/fpm_sockets\/new.advayta.org.sock/g' "$PHP_INI_DIR/../php-fpm.d/www.conf"
RUN sed -i 's/listen = 9000/listen = \/var\/run\/fpm_sockets\/new.advayta.org.sock/g' "$PHP_INI_DIR/../php-fpm.d/zz-docker.conf"

# Capture fpm output to stdout and stderr
RUN sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/g' "$PHP_INI_DIR/../php-fpm.d/www.conf"
RUN sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/g' "$PHP_INI_DIR/../php-fpm.d/zz-docker.conf"

# Make sure cgi.fix_pathinfo is off
# RUN echo 'cgi.fix_pathinfo=0' >> $PHP_INI_DIR/../php-fpm.d/www.conf
# RUN echo 'cgi.fix_pathinfo=0' >> $PHP_INI_DIR/../php-fpm.d/zz-docker.conf

# Fix socket file permissions
RUN sed -i 's/;listen.owner = www-data/listen.owner = www-data/g' "$PHP_INI_DIR/../php-fpm.d/www.conf"
RUN sed -i 's/;listen.group = www-data/listen.group = www-data/g' "$PHP_INI_DIR/../php-fpm.d/www.conf"
RUN sed -i 's/;listen.mode = /listen.mode = /g' "$PHP_INI_DIR/../php-fpm.d/www.conf"
RUN sed -i 's/;listen.owner = www-data/listen.owner = www-data/g' "$PHP_INI_DIR/../php-fpm.d/zz-docker.conf"
RUN sed -i 's/;listen.group = www-data/listen.group = www-data/g' "$PHP_INI_DIR/../php-fpm.d/zz-docker.conf"
RUN sed -i 's/;listen.mode = /listen.mode = /g' "$PHP_INI_DIR/../php-fpm.d/zz-docker.conf"

# we are using sockets no need to expose
# EXPOSE 9000
23 changes: 23 additions & 0 deletions php/build-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
COMPANY_NAME=webdevelop-pro
SERVICE_NAME=php

case $1 in

*)
BRANCH_NAME=`git rev-parse --abbrev-ref HEAD`
GIT_COMMIT=`git rev-parse --short HEAD`
echo $BRANCH_NAME, $GIT_COMMIT
docker build -t webdeveloppro/$SERVICE_NAME:v8.2 -t webdeveloppro/$SERVICE_NAME:latest-dev --platform=linux/amd64 .
# snyk container test cr.webdevelop.us/$COMPANY_NAME/$SERVICE_NAME:$GIT_COMMIT
if [ $? -ne 0 ]; then
echo "===================="
echo "snyk has found a vulnerabilities, please consider choosing alternative image from snyk"
echo "===================="
return
fi
docker push webdeveloppro/$SERVICE_NAME:latest-dev
docker push webdeveloppro/$SERVICE_NAME:v8.2
;;

esac

2 changes: 1 addition & 1 deletion python-common/etc/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ self-update)
;;

run-dev)
nodemon -u -w app -e py --exec python app/__main__.py
nodemon -u -w app -e py --exec python -m app
;;

run)
Expand Down

0 comments on commit e0abfa6

Please sign in to comment.