Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerization added. #165

Open
wants to merge 1 commit into
base: 3.16.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use the official PHP image as the base image
FROM php:8.3-fpm

# Set working directory
WORKDIR /var/www/html

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
unzip

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Copy existing application directory contents
COPY . /var/www/html

# Install PHP dependencies
RUN composer install

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ After choosing and installing the packages you want, go to the
$ composer serve
```

Or use Docker Compose to run the app:

```bash
$ cp nginx.conf.dist nginx.conf
$ docker compose up -d
```

You can then browse to http://localhost:8080.

## Installing alternative packages
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
php:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/var/www/html
expose:
- 9000

nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- .:/var/www/html
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- php
29 changes: 29 additions & 0 deletions nginx.conf.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name localhost;

root /var/www/html;
index public/index.php index.html index.htm;

location / {
try_files $uri $uri/ /public/index.php?$query_string;
autoindex on;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index public/index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~ /\.ht {
deny all;
}
}
}
Loading