Moved to caddy and docker for local dev

This commit is contained in:
Michel 2024-10-30 19:39:55 +01:00
parent c3e81ce6ea
commit af6b2b752e
5 changed files with 36 additions and 50 deletions

39
deploy/Vagrantfile vendored
View file

@ -1,39 +0,0 @@
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 600
config.vm.box = "ubuntu/focal64"
config.vm.network :forwarded_port, guest: 80, host: 1111
config.vm.synced_folder "../../games-shop", "/var/www/html"
config.vm.provision "shell", inline: <<-SHELL
sudo apt update
# Install dependencies
sudo apt install ca-certificates apt-transport-https software-properties-common lsb-release debian-keyring debian-archive-keyring curl -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install nginx php8.3 php8.3-{cli,fpm,curl,gd,zip,fileinfo,common,sqlite3,dom,mbstring,simplexml,xml,xmlreader,xmlwriter} -y
sudo ufw allow "OpenSSH"
sudo ufw allow "Nginx HTTP"
sudo ufw --force enable
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /var/www/html/deploy/nginx-file /etc/nginx/sites-enabled/default
sudo systemctl enable --now nginx
sudo systemctl restart nginx
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
SHELL
end

View file

@ -0,0 +1,6 @@
:80 {
root * /app/public
encode gzip
php_fastcgi php-fpm:9000
file_server
}

View file

@ -0,0 +1,8 @@
FROM php:8.3-fpm
RUN apt-get update && \
apt-get install -y \
libzip-dev libpng-dev
RUN docker-php-ext-install zip
RUN docker-php-ext-install gd

View file

@ -0,0 +1,22 @@
services:
caddy:
container_name: gamesshop_caddy
image: caddy
ports:
- 8080:80
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./../..:/app
- caddy_config:/config
- caddy_data:/data
depends_on:
- php-fpm
php-fpm:
container_name: gamesshop_php
build: .
volumes:
- ./../..:/app
volumes:
caddy_data:
caddy_config:

View file

@ -1,11 +0,0 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/public;
location / {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
}