Compare commits

...

7 commits

Author SHA1 Message Date
OpenVisor ed68845582 Fix typos 2024-06-28 23:23:09 +02:00
OpenVisor cf4a0b31ea Add "docker-compose.yml" to URL 2024-06-28 23:22:09 +02:00
OpenVisor 1352c5e28f Add "Dockerfile" to URL 2024-06-28 23:21:56 +02:00
OpenVisor d75e5104b9 Add "post-receive" to URL 2024-06-28 23:21:27 +02:00
OpenVisor 826690530b Add README.md 2024-06-28 23:09:06 +02:00
OpenVisor 9119984c1d Add empty LICENSE file 2024-06-28 23:08:59 +02:00
OpenVisor 92510c38d0 Add dockerizationƒ 2024-06-28 23:05:30 +02:00
8 changed files with 161 additions and 2 deletions

17
.dockerignore Normal file
View file

@ -0,0 +1,17 @@
# geschichtenfabio-dockerized/.dockerignore
# https://git.openvisor.ch/Rider/geschichtenfabio
# docker files
Dockerfile
docker-compose.yml
.env
# git files
branches
config
descriptiom
HEAD
hooks
info
objects
refs

44
Dockerfile Normal file
View file

@ -0,0 +1,44 @@
# geschichtenfabio-dockerized/Dockerfile
# https://git.openvisor.ch/Rider/geschichtenfabio/Dockerfile
# BUILD STAGE
#FROM node:22.1.0-alpine3.19 as build-stage
#WORKDIR /app
# add resources required to build the web application
#COPY . .
# PRODUCTION STAGE
FROM nginx:1.26.0-alpine3.19 as production-stage
WORKDIR /usr/share/nginx/html
# use custom error code websites instead
#RUN rm -f /usr/share/nginx/html/50x.html
# update default.conf nginx file with necessary try_files statement
RUN rm -f /etc/nginx/conf.d/default.conf
RUN mkdir ./geschichten
RUN mkdir ./images
# enable the nginx user to be able to launch the web application, so root is not required
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
USER nginx
COPY --chown=nginx:nginx ./default.conf /etc/nginx/conf.d/default.conf
# add the previously built web application
COPY --chown=www-data:www-data ./app/geschichten/ ./geschichten/
COPY --chown=www-data:www-data ./app/images/ ./images/
COPY --chown=www-data:www-data ./app/style.css ./style.css
COPY --chown=www-data:www-data ./app/index.html ./index.html
EXPOSE 80
# check every minute whether the website is still locally reachable; if not, the docker process displays "unhealthy"
HEALTHCHECK --interval=1m CMD wget --no-verbose --tries=1 http://localhost:80 -q -O /dev/null || exit 1
# runs nginx in the foreground which means the docker container only runs as long as nginx is running (good practice)
CMD ["nginx", "-g", "daemon off;"]

0
LICENSE Normal file
View file

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Geschichten Fabio
Website online on: [https://geschichtenfabio.ch](https://geschichtenfabio.ch)
## License
[LICENSE](./LICENSE)

54
default.conf Normal file
View file

@ -0,0 +1,54 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
# Added try_files to ensure that one can link or type a specific URI
try_files $uri $uri/ /index.html;
}
# Added charset utf-8; to ensure UTF-8 is supported
charset utf-8;
# TODO: Add custom error pages (for now they're commented out)
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

20
docker-compose.yml Normal file
View file

@ -0,0 +1,20 @@
# geschichtenfabio-dockerized/docker-compose.yml
# https://git.openvisor.ch/Rider/geschichtenfabio/docker-compose.yml
networks:
geschichtenfabio-network:
name: geschichtenfabio-network
driver: bridge
external: false
attachable: false
services:
geschichtenfabio-app:
container_name: geschichtenfabio-app
restart: unless-stopped
build: .
# ensure that web application is not run by root
user: nginx:nginx
ports:
- 2443:80
networks:
- geschichtenfabio-network

View file

@ -20,10 +20,10 @@
<section> <section>
<!--<h2>Meine Kurzgeschichten-Sammlung</h2> <!--<h2>Meine Kurzgeschichten-Sammlung</h2>
<p> <p>
Sitzst du im Zug, bist gestresst oder ist dir langweilig? Dann entkomme der Wirklichkeit für eine kurze Zeit mit einer kleinen Geschichte. Sitzt du im Zug, bist gestresst oder ist dir langweilig? Dann entkomme der Wirklichkeit für eine kurze Zeit mit einer kleinen Geschichte.
Hier veröffentliche ich meine persönliche Sammlung selbst geschriebener Kurzgeschichten. Hier veröffentliche ich meine persönliche Sammlung selbst geschriebener Kurzgeschichten.
Kurz, aber trotzdem kannst du in eine völlig neue Welt eintauchen. Futuristischer Sci-Fi, kleine Gedankenexperimente oder mysteriöse Fantasiewelten. Kurz, aber trotzdem kannst du in eine völlig neue Welt eintauchen. Futuristischer Sci-Fi, kleine Gedankenexperimente oder mysteriöse Fantasiewelten.
Suche eine Geschichte heraus und leg los. Viel spass beim Lesen. Suche eine Geschichte heraus und leg los. Viel Spass beim Lesen!
</p>--> </p>-->
</section> </section>

19
post-receive Normal file
View file

@ -0,0 +1,19 @@
# geschichtenfabio-dockerized/hooks/post-receive
# https://git.openvisor.ch/Rider/geschichtenfabio/post-receive
#!/bin/bash
REPOSITORY=/opt/geschichtenfabio-dockerized
git --work-tree=${REPOSITORY} --git-dir=${REPOSITORY} -f
touch ${REPOSITORY}/FLAG-FOR-CRONJOB-DOCKER-AUTOMATION
# content of /etc/cron.daily/geschichtenfabio-docker-automation
##!/bin/sh
#REPOSITORY=/opt/geschichtenfabio-dockerized
#if [ -f ${REPOSITORY}/FLAG-FOR-CRONJOB-DOCKER-AUTOMATION ];
# then
# docker compose build
# docker compose stop
# docker rm openvisorwebsite-app
# docker compose up -d
# rm ${REPOSITORY}/FLAG-FOR-CRONJOB-DOCKER-AUTOMATION
#fi