From bc2a8db0b0a98e15a1844297cabd793c2b6ab834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=A7=D0=B5?= =?UTF-8?q?=D0=BA=D0=B0=D0=BB=D0=BE=D0=B2?= Date: Mon, 3 Apr 2023 21:39:07 +0400 Subject: [PATCH 1/2] Dockerfile --- .github/workflows/build.yml | 2 -- Dockerfile | 14 +++++++++ docker/nginx/default | 63 +++++++++++++++++++++++++++++++++++++ entrypoint | 4 +++ src/index.php | 3 ++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 docker/nginx/default create mode 100644 entrypoint create mode 100644 src/index.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a821b13..3013577 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,8 +13,6 @@ jobs: steps: - uses: actions/checkout@v3 - # TODO build project - - uses: docker/setup-buildx-action@v2 - name: Build docker image diff --git a/Dockerfile b/Dockerfile index e69de29..5bd016b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM php:8.1-fpm + +WORKDIR /var/www + +RUN apt update -y && apt install -y nginx + +COPY src . +COPY /docker/nginx/default /etc/nginx/sites-available/default + +COPY entrypoint entrypoint +RUN chmod +x ./entrypoint +ENTRYPOINT ["./entrypoint"] + +EXPOSE 8080 diff --git a/docker/nginx/default b/docker/nginx/default new file mode 100644 index 0000000..5e36999 --- /dev/null +++ b/docker/nginx/default @@ -0,0 +1,63 @@ +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen 8080 default_server; + listen [::]:8080 default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www; + + # Add index.php to the list if you are using PHP + index index.php; + + server_name _; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + # pass PHP scripts to FastCGI server + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass 127.0.0.1:9000; + } + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + location ~ /\.ht { + deny all; + } +} diff --git a/entrypoint b/entrypoint new file mode 100644 index 0000000..268a3ce --- /dev/null +++ b/entrypoint @@ -0,0 +1,4 @@ +#!/bin/sh + +service nginx restart +php-fpm diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..5b5ea42 --- /dev/null +++ b/src/index.php @@ -0,0 +1,3 @@ + Date: Mon, 3 Apr 2023 21:47:43 +0400 Subject: [PATCH 2/2] fix greeting --- src/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.php b/src/index.php index 5b5ea42..b0d2df2 100644 --- a/src/index.php +++ b/src/index.php @@ -1,3 +1,3 @@