WIP: dockerize the website
This commit is contained in:
@@ -45,12 +45,14 @@ echo:
|
|||||||
.PHONY: ampTest
|
.PHONY: ampTest
|
||||||
ampTest: $(ampFiles)
|
ampTest: $(ampFiles)
|
||||||
|
|
||||||
|
.PHONY: INSTALL_DEPENDENCIES
|
||||||
|
INSTALL_DEPENDENCIES:
|
||||||
|
npm install csso
|
||||||
|
npm install --save-dev --save-exact prettier
|
||||||
|
|
||||||
build/css/cwsvJudo.css: $(cssFiles)
|
build/css/cwsvJudo.css: $(cssFiles)
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
cat $^ > $@
|
npx csso --input $^ --output $@
|
||||||
# cat $(cssFiles) | cleancss -o $@
|
|
||||||
# cat $^ | ./node_modules/.bin/csso -o $@
|
|
||||||
# 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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
CSSO = node_modules/csso-cli/bin/csso
|
#!/usr/bin/env make -f
|
||||||
|
|
||||||
RES_LIST = 64 128 256 512
|
RES_LIST = 64 128 256 512
|
||||||
|
|
||||||
@@ -9,6 +9,9 @@ ampFiles = $(patsubst src/md/%.md, build/amp/%.php, $(mdFiles))
|
|||||||
phpLibFiles = $(wildcard phpLib/cwsvJudo/*.php) phpLib/phpcount/phpcount.php
|
phpLibFiles = $(wildcard phpLib/cwsvJudo/*.php) phpLib/phpcount/phpcount.php
|
||||||
configFiles = $(wildcard config/*.php)
|
configFiles = $(wildcard config/*.php)
|
||||||
|
|
||||||
|
distDir=./build/dist/heliohost
|
||||||
|
|
||||||
|
LN = cp -r
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(phpFiles)
|
all: $(phpFiles)
|
||||||
@@ -20,8 +23,44 @@ all: $(phpFiles)
|
|||||||
clean:
|
clean:
|
||||||
$(RM) -rf build
|
$(RM) -rf build
|
||||||
|
|
||||||
|
# copy/link all together to get a distributable package
|
||||||
|
.PHONY: dist
|
||||||
|
dist: all
|
||||||
|
mkdir -p $(distDir)
|
||||||
|
# page data
|
||||||
|
mkdir -p $(distDir)/httpdocs/pages/
|
||||||
|
$(LN) ./build/materialize $(distDir)/httpdocs/pages/responsive
|
||||||
|
$(LN) ./src/shared/ $(distDir)/httpdocs/pages/shared
|
||||||
|
# php lib
|
||||||
|
mkdir -p $(distDir)/httpdocs/ressourcen/phpLib
|
||||||
|
$(LN) ./phpLib/cwsvJudo $(distDir)/httpdocs/ressourcen/phpLib/cwsvJudo
|
||||||
|
$(LN) ./phpLib/phpqrcode $(distDir)/httpdocs/ressourcen/phpLib/phpqrcode
|
||||||
|
# graphics
|
||||||
|
mkdir -p $(distDir)/httpdocs/ressourcen/graphiken
|
||||||
|
$(LN) ./build/graphiken/cwsvJudoLogoWappen $(distDir)/httpdocs/ressourcen/graphiken/logos
|
||||||
|
$(LN) ./graphiken/banner $(distDir)/httpdocs/ressourcen/graphiken/banner
|
||||||
|
$(LN) ./build/graphiken/favIcons/favicon.ico $(distDir)/httpdocs/favicon.ico
|
||||||
|
$(LN) ./res/videos.d $(distDir)/httpdocs/videos.d
|
||||||
|
# css
|
||||||
|
mkdir -p $(distDir)/httpdocs/ressourcen/css
|
||||||
|
$(LN) ./build/css/cwsvJudo.css $(distDir)/httpdocs/ressourcen/css/cwsvJudo.css
|
||||||
|
# fonts
|
||||||
|
$(LN) ./res/fonts $(distDir)/httpdocs/ressourcen/fonts
|
||||||
|
# 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 ./build/materialize/.htaccess
|
||||||
|
# config files
|
||||||
|
# @todo Link is into the build directory breaking the above pattern.
|
||||||
|
$(LN) ./configs/heliohost/pages.config.inc.php ./build/materialize/config.inc.php
|
||||||
|
# @todo shouldn't be used any more
|
||||||
|
mkdir -p $(distDir)/.local
|
||||||
|
$(LN) configs/heliohost/db.config.php $(distDir)/.local/db.config.php
|
||||||
|
|
||||||
|
# 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
|
||||||
mkdir -p build/materialize
|
mkdir -p build/materialize
|
||||||
|
# create html/php code
|
||||||
pandoc \
|
pandoc \
|
||||||
--standalone \
|
--standalone \
|
||||||
--css="ressourcen/css/cwsvJudo.css" \
|
--css="ressourcen/css/cwsvJudo.css" \
|
||||||
@@ -30,6 +69,7 @@ build/materialize/%.php: src/md/%.md build/yaml/%.yaml pandocTemplate/materializ
|
|||||||
--wrap=preserve \
|
--wrap=preserve \
|
||||||
--output=$@ \
|
--output=$@ \
|
||||||
$< $(word 2,$^)
|
$< $(word 2,$^)
|
||||||
|
# npx prettier --check $@
|
||||||
|
|
||||||
# @toDo: Verzeichnisstruktur überdenken
|
# @toDo: Verzeichnisstruktur überdenken
|
||||||
build/yaml/%.yaml: src/yaml/images.yaml src/yaml/navTargets.yaml src/yaml/mainNav.yaml src/yaml/%.subNav.yaml
|
build/yaml/%.yaml: src/yaml/images.yaml src/yaml/navTargets.yaml src/yaml/mainNav.yaml src/yaml/%.subNav.yaml
|
||||||
|
|||||||
11
homepage/cwsvJudo/PHP.dockerfile
Normal file
11
homepage/cwsvJudo/PHP.dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# select base image
|
||||||
|
FROM php:fpm
|
||||||
|
|
||||||
|
# startup scripts for the image
|
||||||
|
# - docker-php-ext-install -- install helper script from PHP
|
||||||
|
RUN docker-php-ext-install pdo pdo_mysql
|
||||||
|
|
||||||
|
# install and add xdebug extension
|
||||||
|
# @todo What is pecl?
|
||||||
|
# @todo What is xdebug and how do I use it?
|
||||||
|
RUN pecl install xdebug && docker-php-ext-enable xdebug
|
||||||
8
homepage/cwsvJudo/docker-clean.sh
Normal file
8
homepage/cwsvJudo/docker-clean.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
# stop all containers
|
||||||
|
docker-compose down --remove-orphans
|
||||||
|
# delete all containers
|
||||||
|
docker rm -f $(docker ps -a -q)
|
||||||
|
# delete all volumes
|
||||||
|
docker volume rm $(docker volume ls -q)
|
||||||
77
homepage/cwsvJudo/docker-compose.yaml
Normal file
77
homepage/cwsvJudo/docker-compose.yaml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# version for the docker compose file to use
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
# a dict of services running in the container label: {<service>} label is a self defined name for the service
|
||||||
|
services:
|
||||||
|
# the webserver service
|
||||||
|
web:
|
||||||
|
image: nginx:latest
|
||||||
|
# port forwarding
|
||||||
|
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:
|
||||||
|
context: .
|
||||||
|
dockerfile: PHP.dockerfile
|
||||||
|
# files and directories to be available in the container
|
||||||
|
# @todo Except from better structuring: Is there a reason for not having the volumes as one central list?
|
||||||
|
volumes:
|
||||||
|
# the www-data
|
||||||
|
# - ./build/dist/heliohost:/home/cwsvjudo
|
||||||
|
- ./build/dist/heliohost:/usr/share/nginx/html:ro
|
||||||
|
# # @todo Maybe use postgre instead?
|
||||||
|
database:
|
||||||
|
image: mariadb:latest
|
||||||
|
restart: always
|
||||||
|
# define environment variables
|
||||||
|
# @todo Should credentials be placed here? Even if it is just a test environment
|
||||||
|
environment:
|
||||||
|
# MYSQL_TCP_PORT: 1433
|
||||||
|
MYSQL_USER: "cwsvjudo"
|
||||||
|
MYSQL_DATABASE: "cwsvjudo"
|
||||||
|
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
|
||||||
|
MYSQL_PASSWORD_FILE: /run/secrets/db_password
|
||||||
|
volumes:
|
||||||
|
- 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
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
- db_root_password
|
||||||
|
- db_password
|
||||||
|
# phpmyadmin
|
||||||
|
# phpmyadmin:
|
||||||
|
# image: phpmyadmin:latest
|
||||||
|
# restart: always
|
||||||
|
# depends_on:
|
||||||
|
# - database
|
||||||
|
# - php
|
||||||
|
# ports:
|
||||||
|
# - 8080:80
|
||||||
|
# environment:
|
||||||
|
# # name of the host is the name of the db service started above! Why? I don't know!
|
||||||
|
# - PMA_HOST=database
|
||||||
|
# - PMA_PORT=1433
|
||||||
|
volumes:
|
||||||
|
# data storage for the db
|
||||||
|
mysqldata: {}
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
db_root_password:
|
||||||
|
file: db_root_password.txt
|
||||||
|
db_password:
|
||||||
|
file: db_password.txt
|
||||||
24
homepage/cwsvJudo/nginx.conf
Normal file
24
homepage/cwsvJudo/nginx.conf
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# @todo Needs helpfull comments.
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
# root /users/cwsvjudo/www;
|
||||||
|
# root /home/cwsvjudo/httpdocs;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# rewrite rules
|
||||||
|
# - add php to requested filename if it exists
|
||||||
|
if (-e $request_filename.php) {
|
||||||
|
rewrite ^/(.*)$ /$1.php last;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass php:9000;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/// Einbinden der Konfiguration, insbesondere Basisvariablen,
|
// server specific variables:
|
||||||
/// relative Pfadangabe
|
|
||||||
/// - jedes Verzeichnis sollte seine eigene haben
|
|
||||||
/// - theoretisch sollte es bereits von der aufrufenden Datei
|
|
||||||
/// eingebunden sein
|
|
||||||
require_once("./config.inc.php");
|
require_once("./config.inc.php");
|
||||||
// require_once($$basePath."/config/phpcount.config.php");
|
// database specific variables
|
||||||
require_once($$home."/.local/db.config.php");
|
require_once($$home."/.local/db.config.php");
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/newsLib.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/wkKalender.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/galTable.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/newsTableHtml.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/newsLib.php");
|
|
||||||
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/galleryRedirector.php");
|
|
||||||
// require_once($$basePath."/ressourcen/phpLib/phpcount/phpcount.php");
|
|
||||||
|
|
||||||
|
// cwsvJudo lib
|
||||||
|
foreach(["miscAssis", "newsLib", "wkKalender", "galTable", "newsTableHtml", "newsLib", "galleryRedirector"] as $$sublib){
|
||||||
|
require_once($$basePath."/ressourcen/phpLib/cwsvJudo/".$$sublib.".php");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo remove galleries
|
||||||
galleryRedirector();
|
galleryRedirector();
|
||||||
|
|
||||||
$if(phpTitleString)$
|
|
||||||
// PHPCount::AddHit($phpTitleString$);
|
|
||||||
$else$
|
|
||||||
// PHPCount::AddHit("$title$");
|
|
||||||
$endif$
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html$if(lang)$ lang="$lang$" $endif$$if(dir)$ dir="$dir$" $endif$>
|
<html $if(lang)$lang="$lang$"$endif$ $if(dir)$dir="$dir$"$endif$>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
@@ -38,7 +26,10 @@ $endif$
|
|||||||
<meta name="dcterms.date" content="$date-meta$">
|
<meta name="dcterms.date" content="$date-meta$">
|
||||||
$endif$
|
$endif$
|
||||||
$if(keywords)$
|
$if(keywords)$
|
||||||
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$">
|
<meta
|
||||||
|
name="keywords"
|
||||||
|
content="$for(keywords)$$keywords$$sep$, $endfor$"
|
||||||
|
>
|
||||||
$endif$
|
$endif$
|
||||||
$if(canonicalPath)$
|
$if(canonicalPath)$
|
||||||
<link rel="canonical" href="<?php echo($$canonicalBaseUrl);?>/$canonicalPath$">
|
<link rel="canonical" href="<?php echo($$canonicalBaseUrl);?>/$canonicalPath$">
|
||||||
@@ -47,12 +38,12 @@ $endif$
|
|||||||
<link rel="amphtml" href="$ampVersionLink$">
|
<link rel="amphtml" href="$ampVersionLink$">
|
||||||
$endif$
|
$endif$
|
||||||
$if(phpTitleString)$
|
$if(phpTitleString)$
|
||||||
<title>
|
<title><?php echo( $phpTitleString$ );?>
|
||||||
<?php echo( $phpTitleString$ );?>
|
|
||||||
</title>
|
</title>
|
||||||
$else$$if(title)$
|
$else$$if(title)$
|
||||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||||
$endif$$endif$
|
$endif$
|
||||||
|
$endif$
|
||||||
$if(phpDescriptionString)$
|
$if(phpDescriptionString)$
|
||||||
<meta name="description" content="<?php echo( $phpDescriptionString$ );?>">
|
<meta name="description" content="<?php echo( $phpDescriptionString$ );?>">
|
||||||
$else$$if(description)$
|
$else$$if(description)$
|
||||||
@@ -69,8 +60,9 @@ $endif$
|
|||||||
|
|
||||||
$if(css)$
|
$if(css)$
|
||||||
<style>
|
<style>
|
||||||
$for(css)$ <?php include_once($$basePath."/$css$");
|
$for(css)$
|
||||||
?>$endfor$
|
<?php include_once($$basePath."/$css$");?>
|
||||||
|
$endfor$
|
||||||
</style>
|
</style>
|
||||||
$endif$
|
$endif$
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// Umleiten auf eine per query galId im $_GET gegebene Galerie
|
// Umleiten auf eine per query galId im $_GET gegebene Galerie
|
||||||
function galleryRedirector(){
|
function galleryRedirector(){
|
||||||
global $cwsvJudoConfig;
|
global $cwsvJudoConfig;
|
||||||
|
$baseDomain = $GLOBALS["baseDomain"];
|
||||||
// require_once($_SERVER['DOCUMENT_ROOT']."/bonus/db.inc");
|
// require_once($_SERVER['DOCUMENT_ROOT']."/bonus/db.inc");
|
||||||
|
|
||||||
if(isset($_GET['galId'])){
|
if(isset($_GET['galId'])){
|
||||||
|
|||||||
0
homepage/cwsvJudo/src/html/index.html
Normal file
0
homepage/cwsvJudo/src/html/index.html
Normal file
Reference in New Issue
Block a user