diff --git a/.gitignore b/.gitignore index 3eec6c0..4000091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ resources public +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55977d1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM registry.lamelio.fr/nginx-lowtech:0.0.5 + +# Copie des sources du site +COPY public /usr/share/nginx/html diff --git a/README.md b/README.md index c9a041f..8a1927f 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,4 @@ Description les commandes : - `./run install` : Installe les dépendances - `./run dev` : Lance hugo pour le développement avec l'autoreload - `./run build` : Lance la génération du site pour la prod +- `./run deploy` : Lance le déploiement du site diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e3979cf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,64 @@ +version: "3.7" + +volumes: + lowtechweb-log: + name: lowtechweb-log + lowtechweb-stats: + name: lowtechweb-stats + +services: + lowtechweb-autopush: + container_name: lowtechweb-autopush + image: registry.lamelio.fr/autopush + restart: always + depends_on: + - lowtechweb + environment: + GIT_USER: ${GIT_USER} + GIT_URL: ${GIT_URL} + GIT_REPOSITORY: ${GIT_REPOSITORY} + DOWNLOAD_URL: ${DOWNLOAD_URL} + WEBDAV_URL: ${WEBDAV_URL} + labels: + com.centurylinklabs.watchtower.enable: true + + lowtechweb-logs: + container_name: lowtechweb-logs + image: registry.lamelio.fr/goaccess + restart: always + depends_on: + - lowtechweb-autopush + volumes: + - lowtechweb-log:/var/log/nginx + - lowtechweb-stats:/usr/share/nginx/html/stats + labels: + com.centurylinklabs.watchtower.enable: true + + lowtechweb: + container_name: ${NAME} + image: registry.lamelio.fr/lowtechweb + restart: always + environment: + - TZ=${TIMEZONE} + volumes: + - lowtechweb-log:/var/log/nginx + - lowtechweb-stats:/usr/share/nginx/html/stats + labels: + traefik.enable: "true" + + traefik.http.routers.lowtechweb.rule: "Host(`${URL}`)" + traefik.http.routers.lowtechweb.entrypoints: "websecure" + traefik.http.routers.lowtechweb.tls.certResolver: "letsencrypt" + + # Redirect https://www to https:// + traefik.http.routers.lowtechweb-redirect-www.rule: "Host(`www.${URL}`)" + traefik.http.routers.lowtechweb-redirect-www.entrypoints: "websecure" + traefik.http.routers.lowtechweb-redirect-www.tls.certResolver: "letsencrypt" + traefik.http.routers.lowtechweb-redirect-www.middlewares: "redirect-www@docker" + + com.centurylinklabs.watchtower.enable: true + +networks: + default: + external: + name: traefik diff --git a/run b/run index 9a22dd7..756db1f 100755 --- a/run +++ b/run @@ -5,6 +5,7 @@ set -eu START=`date +%s` +PROJECT=lowtechweb echo echo "┌┐░░░░░░┌──┐░░┌┐░┌┬─┬┐░┌┐░" @@ -20,7 +21,14 @@ if [ $# -ge 1 ]; then rm -rf public hugo -D --minify node themes/hugo-theme-lowtech/scripts/typo - # docker-compose up -d --build --force-recreate + elif [ $1 == "deploy" ]; then + echo "😎 Commence le déploiement du site" + echo + echo "- Construction de l'image docker 🚀" + docker build . -t kosssi/$PROJECT + docker tag kosssi/$PROJECT registry.lamelio.fr/$PROJECT + docker push registry.lamelio.fr/$PROJECT + docker-compose up -d elif [ $1 == "install" ]; then echo "- Initialisation de git submodule" git submodule init @@ -33,6 +41,7 @@ else echo "- ./run install : Installe les dépendances" echo "- ./run dev : Lance hugo pour le développement avec l'autoreload" echo "- ./run build : Lance la génération du site pour la prod" + echo "- ./run deploy : Lance le déploiement du site" echo fi