Skip to content

Add scaffolding #2

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

Merged
merged 1 commit into from
Dec 18, 2023
Merged
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore system files
.DS_Store
Thumbs.db

# Ignore composer dependencies
/vendor
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM php:8.2-fpm as php-fpm
WORKDIR /var/www/html

COPY ./ ./

FROM nginx:1.25 as nginx
COPY ./nginx.conf /etc/nginx/nginx.conf

FROM mysql:8.0 as mysql
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.8"

services:
php-fpm:
build:
context: .
target: php-fpm
image: cycleops/php-demo:php-fpm
ports:
- 9000:9000
volumes:
- ./www/html/:/var/www/html/

nginx:
build:
context: .
target: nginx
image: cycleops/php-demo:nginx
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./www/html/:/var/www/html/
restart: on-failure

mysql:
image: mysql:8.0
volumes:
- mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: mydatabase
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword

volumes:
mysql_data:
27 changes: 27 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name localhost;
root /var/www/html;

index index.php index.html index.htm;

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

location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php-fpm:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}

9 changes: 9 additions & 0 deletions www/html/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<head>
<title>Cycleops</title>
</head>

<body>
<h1>Welcome to Cycleops</h1>
<p><?php echo 'We are running PHP, version: ' . phpversion(); ?></p>
</body>