chore: initial commit with Docker + Ansible base

This commit is contained in:
2025-05-18 16:37:48 +02:00
commit 3284204281
11 changed files with 88 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.idea/
vendor/
node_modules/
.env
*.log
*.retry
ansible/.vault_pass

16
Makefile Normal file
View File

@@ -0,0 +1,16 @@
.PHONY: deploy setup stop build restart
setup:
ansible-playbook -i ansible/inventory.ini ansible/setup.yml
deploy:
ansible-playbook -i ansible/inventory.ini ansible/deploy.yml
stop:
docker compose down
build:
docker compose build --no-cache
restart: stop build
docker compose up -d

4
ansible/deploy.yml Normal file
View File

@@ -0,0 +1,4 @@
- hosts: web
become: false
roles:
- deploy

2
ansible/inventory.ini Normal file
View File

@@ -0,0 +1,2 @@
[web]
localhost ansible_connection=local

View File

@@ -0,0 +1,14 @@
- name: Stoppe laufende Container
command: docker compose down
args:
chdir: "{{ playbook_dir }}/../"
- name: Baue Images neu (ohne Cache)
command: docker compose build --no-cache
args:
chdir: "{{ playbook_dir }}/../"
- name: Starte Container neu
command: docker compose up -d
args:
chdir: "{{ playbook_dir }}/../"

View File

@@ -0,0 +1,3 @@
- name: Test-Task Setup-Rolle lokal
debug:
msg: "Setup-Rolle ist vorbereitet echte Installation folgt auf Server."

4
ansible/setup.yml Normal file
View File

@@ -0,0 +1,4 @@
- hosts: web
become: false
roles:
- setup

3
app/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM nginx:stable-alpine
COPY nginx/default.conf /etc/nginx/conf.d/default.conf

2
app/html/index.php Normal file
View File

@@ -0,0 +1,2 @@
<?php
phpinfo();

17
app/nginx/default.conf Normal file
View File

@@ -0,0 +1,17 @@
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
}
}

16
docker-compose.yml Normal file
View File

@@ -0,0 +1,16 @@
version: "3.9"
services:
web:
build: ./app
ports:
- "8000:80"
volumes:
- ./app/html:/var/www/html
depends_on:
- php
php:
image: php:8.4-fpm
volumes:
- ./app/html:/var/www/html