Skip to content

Commit

Permalink
add dockerfile and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PandorasActorMS committed Sep 18, 2023
1 parent 26f4877 commit 8119b50
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:latest
COPY default.conf /etc/nginx/conf.d/default.conf
12 changes: 12 additions & 0 deletions Dockerfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM php:8.2-fpm
#WORKDIR /var/www/html
COPY ./ /var/www/html/

RUN apt-get update \
&& apt-get install -y git libzip-dev zip \
&& docker-php-ext-install zip \
&& cd /var/www/html \
&& chmod +x composer_install.sh && ./composer_install.sh \
&& mv composer.phar /usr/local/bin/composer \
&& composer install \
&& rm compose.yml composer_install.sh default.conf Dockerfile.nginx Dockerfile.php
22 changes: 22 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#php:8-fpm-alpine
#nginx:latest-alpine //v1.25

services:
nginx:
build:
dockerfile: Dockerfile.nginx
ports:
- "8000:80"
volumes:
- myVolume:/var/www/html
links:
- php-fpm

php-fpm:
build:
dockerfile: Dockerfile.php
volumes:
- myVolume:/var/www/html

volumes:
myVolume:
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"jumbojett/openid-connect-php": "^0.9.10"
}
}
17 changes: 17 additions & 0 deletions composer_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
24 changes: 24 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server {
index index.php index.html;
server_name phpfpm.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;

location ~/.(env*)$ {
return 404;
}

location ~ \.php$ {
index index.php;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}


}

0 comments on commit 8119b50

Please sign in to comment.