Ajout de la commande de déploiement

This commit is contained in:
Simon 2020-05-08 10:26:57 +02:00
parent a9798886f3
commit 306623feae
5 changed files with 80 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
resources
public
.env

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM registry.lamelio.fr/nginx-lowtech:0.0.5
# Copie des sources du site
COPY public /usr/share/nginx/html

View File

@ -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

64
docker-compose.yml Normal file
View File

@ -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

11
run
View File

@ -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