working version of dockerized website

This commit is contained in:
marko
2024-12-01 19:23:07 +01:00
parent 27a96f0cf0
commit a2aa2f1124
8 changed files with 64 additions and 64 deletions

View File

@@ -47,12 +47,12 @@ ampTest: $(ampFiles)
.PHONY: INSTALL_DEPENDENCIES .PHONY: INSTALL_DEPENDENCIES
INSTALL_DEPENDENCIES: INSTALL_DEPENDENCIES:
npm install csso npm install csso-cli
npm install --save-dev --save-exact prettier npm install --save-dev --save-exact prettier
build/css/cwsvJudo.css: $(cssFiles) build/css/cwsvJudo.css: $(cssFiles)
mkdir -p $(dir $@) mkdir -p $(dir $@)
npx csso --input $^ --output $@ cat $^ | $(CSSO) -o $@
build/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/cwsvJudo.html5.pandocTemplate build/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/cwsvJudo.html5.pandocTemplate
mkdir -p build mkdir -p build

View File

@@ -26,6 +26,7 @@ clean:
# copy/link all together to get a distributable package # copy/link all together to get a distributable package
.PHONY: dist .PHONY: dist
dist: all dist: all
rm -r $(distDir)
mkdir -p $(distDir) mkdir -p $(distDir)
# page data # page data
mkdir -p $(distDir)/httpdocs/pages/ mkdir -p $(distDir)/httpdocs/pages/
@@ -36,26 +37,28 @@ dist: all
$(LN) ./phpLib/cwsvJudo $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo $(LN) ./phpLib/cwsvJudo $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo
$(LN) ./phpLib/phpqrcode $(distDir)/httpdocs/ressourcen/phpLib/phpqrcode $(LN) ./phpLib/phpqrcode $(distDir)/httpdocs/ressourcen/phpLib/phpqrcode
# graphics # graphics
mkdir -p $(distDir)/httpdocs/ressourcen/graphiken mkdir -p $(distDir)/httpdocs/ressourcen/graphiken/logos
$(LN) ./build/graphiken/cwsvJudoLogoWappen $(distDir)/httpdocs/ressourcen/graphiken/logos $(LN) ./build/graphiken/cwsvJudoLogoWappen/* $(distDir)/httpdocs/ressourcen/graphiken/logos
$(LN) ./graphiken/icons $(distDir)/httpdocs/ressourcen/graphiken/
$(LN) ./graphiken/banner $(distDir)/httpdocs/ressourcen/graphiken/banner $(LN) ./graphiken/banner $(distDir)/httpdocs/ressourcen/graphiken/banner
$(LN) ./build/graphiken/favIcons/favicon.ico $(distDir)/httpdocs/favicon.ico $(LN) ./build/graphiken/favIcons/favicon.ico $(distDir)/httpdocs/favicon.ico
$(LN) ./res/videos.d $(distDir)/httpdocs/videos.d $(LN) ./res/videos.d $(distDir)/httpdocs/videos.d
$(LN) ./res/IntegrationDurchSport2018.250x.png $(distDir)/httpdocs/ressourcen/graphiken/logos
# css # css
mkdir -p $(distDir)/httpdocs/ressourcen/css mkdir -p $(distDir)/httpdocs/ressourcen/css
$(LN) ./build/css/cwsvJudo.css $(distDir)/httpdocs/ressourcen/css/cwsvJudo.css $(LN) ./build/css/cwsvJudo.css $(distDir)/httpdocs/ressourcen/css/cwsvJudo.css
# fonts # fonts
$(LN) ./res/fonts $(distDir)/httpdocs/ressourcen/fonts $(LN) ./res/fonts $(distDir)/httpdocs/ressourcen/fonts
# htaccess # htaccess
$(LN) ./src/htaccess/heliohost/.htaccess $(distDir)/httpdocs/.htaccess $(LN) ./src/htaccess/heliohost/.htaccess $(distDir)/httpdocs/.htaccess
# @todo Link is into the build directory breaking the above pattern. $(LN) ./src/htaccess/heliohost/pages/responsive/.htaccess $(distDir)/httpdocs/pages/responsive/.htaccess
$(LN) ./src/htaccess/heliohost/pages/responsive/.htaccess ./build/materialize/.htaccess
# config files # config files
# @todo Link is into the build directory breaking the above pattern. $(LN) ./configs/heliohost/pages.config.inc.php $(distDir)/httpdocs/pages/responsive/config.inc.php
$(LN) ./configs/heliohost/pages.config.inc.php ./build/materialize/config.inc.php
# @todo shouldn't be used any more # @todo shouldn't be used any more
mkdir -p $(distDir)/.local mkdir -p $(distDir)/.local
$(LN) configs/heliohost/db.config.php $(distDir)/.local/db.config.php $(LN) configs/local/db.config.php $(distDir)/.local/db.config.php
docker-compose restart
# build the materialize version of the page # build the materialize version of the page
build/materialize/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/materialize.pandocTemplate build/materialize/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/materialize.pandocTemplate

View File

@@ -1,5 +1,5 @@
# select base image # select base image
FROM php:fpm FROM php:8.2-apache
# startup scripts for the image # startup scripts for the image
# - docker-php-ext-install -- install helper script from PHP # - docker-php-ext-install -- install helper script from PHP
@@ -9,3 +9,5 @@ RUN docker-php-ext-install pdo pdo_mysql
# @todo What is pecl? # @todo What is pecl?
# @todo What is xdebug and how do I use it? # @todo What is xdebug and how do I use it?
RUN pecl install xdebug && docker-php-ext-enable xdebug RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN ln /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

View File

@@ -0,0 +1,6 @@
<?php
$cwsvJudoConfig["db"]["host"] = "db";
$cwsvJudoConfig["db"]["name"] = "cwsvjudo";
$cwsvJudoConfig["db"]["user"] = "cwsvjudo";
$cwsvJudoConfig["db"]["password"] = "kodokan";
?>

View File

@@ -1,71 +1,49 @@
# version for the docker compose file to use version: '3'
version: "3"
# a dict of services running in the container label: {<service>} label is a self defined name for the service
services: services:
# the webserver service
web: web:
image: nginx:latest # check the php version you need for your project
# port forwarding # image: php:8.2-apache
ports:
# forward port 80 top port 80 in the container
- "8080:80"
# files and directories to be available in the container
# - localPath:pathInContainer
volumes:
# nginx config file
# - ./nginx.conf:/etc/nginx/conf.d/nginx.conf
# the www-data
# - ./build/dist/heliohost:/home/cwsvjudo/httpdocs
- ./build/dist/heliohost:/usr/share/nginx/html:Z
# php and extensions
php:
# use pre-build image from docker..
# image: php:fpm
# .. or build your own image
build: build:
context: . context: .
dockerfile: PHP.dockerfile dockerfile: PHP.dockerfile
# files and directories to be available in the container ports:
# @todo Except from better structuring: Is there a reason for not having the volumes as one central list? - "8080:80" #this line maps your pc port to the container port
depends_on:
# this line links this container to the db container
- db
volumes: volumes:
# the www-data # this line maps the content of ./html in your pc to the /var/www/html of the container
# - ./build/dist/heliohost:/home/cwsvjudo - ./build/dist/heliohost/httpdocs:/var/www/html
- ./build/dist/heliohost:/usr/share/nginx/html:ro - ./build/dist/heliohost/:/home/cwsvjudo.helioho.st/
# # @todo Maybe use postgre instead? db:
database: # check the mysql version you need for your project
image: mariadb:latest image: mariadb:latest
restart: always restart: always
# define environment variables
# @todo Should credentials be placed here? Even if it is just a test environment
environment: environment:
# MYSQL_TCP_PORT: 1433
MYSQL_USER: "cwsvjudo" MYSQL_USER: "cwsvjudo"
MYSQL_DATABASE: "cwsvjudo" MYSQL_DATABASE: "cwsvjudo"
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
MYSQL_PASSWORD_FILE: /run/secrets/db_password MYSQL_PASSWORD_FILE: /run/secrets/db_password
volumes: volumes:
# this line maps the content of ./mysql_data in your pc to the /var/lib/mysql of the container
- mysqldata:/var/lib/mysql - mysqldata:/var/lib/mysql
# initial database
# - has to be created first, e.g., by dumping the database from the productive system
- ./cwsvjudo.sql:/docker-entrypoint-initdb.d/cwsvjudo.sql - ./cwsvjudo.sql:/docker-entrypoint-initdb.d/cwsvjudo.sql
secrets: secrets:
- db_root_password - db_root_password
- db_password - db_password
# phpmyadmin # phpmyadmin
# phpmyadmin: phpmyadmin:
# image: phpmyadmin:latest image: phpmyadmin:latest
# restart: always restart: always
# depends_on: depends_on:
# - database - db
# - php - web
# ports: ports:
# - 8080:80 - 8081:80
# environment: environment:
# # name of the host is the name of the db service started above! Why? I don't know! # name of the host is the name of the db service started above! Why? I don't know!
# - PMA_HOST=database - PMA_HOST=db
# - PMA_PORT=1433 - PMA_PORT=1433
volumes: volumes:
# data storage for the db # data storage for the db
mysqldata: {} mysqldata: {}

View File

@@ -54,7 +54,7 @@
@font-face { @font-face {
font-family: Orbitron-Medium; font-family: Orbitron-Medium;
font-display: fallback; font-display: fallback;
src: url(<?php echo($$canonicalBaseUrl); ?>/ressourcen/fonts/Orbitron-Medium.otf); src: url(/ressourcen/fonts/Orbitron-Medium.otf);
} }
</style> </style>

View File

@@ -61,7 +61,7 @@ return $retKeyValueArray;
/// @brief Gibt die URL der gerade aufgerufenen Seite zurück /// @brief Gibt die URL der gerade aufgerufenen Seite zurück
function getCurPagesUrl(){ function getCurPagesUrl(){
$pageURL = 'http'; $pageURL = 'http';
if ($_SERVER["HTTPS"] == "on"){ if ($_SERVER["HTTPS"]??null == "on"){
$pageURL .= "s"; $pageURL .= "s";
} }
$pageURL .= "://"; $pageURL .= "://";
@@ -203,8 +203,8 @@ if( empty($someOptions['outCharset']) ) $someOptions['outCharset'] = "UTF-8";
return $ret; return $ret;
} }
/** checks if the page is a amp page by checking the reqested url for our amp source */ /** checks if the page is a amp page by checking the requested url for our amp source */
function check_for_amp_site(){ function check_for_amp_site(){
return (strpos( $_SERVER['REQUEST_URI'], "pages/amp" ) !== false ); return (strpos( $_SERVER['REQUEST_URI']??null, "pages/amp" ) !== false );
} }
?> ?>

View File

@@ -1,3 +1,14 @@
# Auf die Fontdatei wird von der Subdomain aus zugegriffen
# - das gesamte ressourcenVerzeichnis wird auf die Maindomain umgeleitet
# - die mainDomain erlaubt aber anscheinend nicht, das fremde domains bei ihr anfragen startet
# - deshalb zumindest für das otf-File den cross domain zugriff erlauben
# (seltsam, dass der Zugriff auf die Bilder unter Photoalben aber erlaubt wird...)
<IfModule mod_headers.c>
<FilesMatch "\.(otf)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
# Url-Rewriting aktivieren # Url-Rewriting aktivieren
RewriteEngine on RewriteEngine on