Merge pull request 'feat: Add auto build website with Drone' (#8) from drone into main
## Détails - Ajout de la configuration automatique de déploiement automatique de staging et de la prod : - un push sur la branche main déclanche un déploiement automatique sur la prod - sur tous les push un déploiment automatique sur staging avec les brouillons et les futurs articles. ## Pourquoi - Pour ne plus à avoir à déployer à la main Reviewed-on: https://git.weko.io/resilien/resilien.fr/pulls/8 Reviewed-by: killian <developer@killiankemps.fr>
This commit is contained in:
commit
0bd687c2e6
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
# drone encrypt resilien/resilien.fr $REGISTRY_PASSWORD
|
||||
kind: secret
|
||||
name: REGISTRY_PASSWORD
|
||||
data: dYAxgJzu+Ic48OIWSFSy1fIG/Z9UUb7ErEyN+3KyI3DaVl1HKWIjdhd6HQZNcgjyKqxZh+smR7CeklVTO2cJhAfQfXIu8ENfGW1QEiFM
|
||||
|
||||
---
|
||||
# drone encrypt resilien/resilien.fr $REGISTRY_USER
|
||||
kind: secret
|
||||
name: REGISTRY_USER
|
||||
data: Y/LGloHcxShJGmqXaGvFJYLSCDbG7wWZap8oywddPdJfcw==
|
||||
|
||||
---
|
||||
# drone encrypt resilien/resilien.fr "{\"auths\":{\"https://registry.weko.io\":{\"auth\":\"$(echo -n "$REGISTRY_USER:$REGISTRY_PASSWORD" | base64)\",\"email\":\"$REGISTRY_USER\"}}}"
|
||||
kind: secret
|
||||
name: REGISTRY_CONFIG
|
||||
data: ICKt0HnBLKDrCNUH1xJnOKCwOMn/R+xMqtO8AxQ8ZorJO/J1O3hUFx3gYH6uKe3y3qa73zGPjSHnTGFv43eGBS0K8L0qQtXdLqIKTOQiIMK9CENN+w8uULCKSls01XHv7zY0bGR5FjmniXCLNYHiWHnJOi8xbAkDorhy6GwhBBpsumsZ6uzA5I0NfHTs+gplvQh6H+6Dmh03ygx39pMfE+P1F2D5VS9OiieS
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: prod
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: install submodule
|
||||
image: drone/git
|
||||
commands:
|
||||
- git submodule update --init
|
||||
|
||||
- name: install npm
|
||||
image: node:current-alpine
|
||||
commands:
|
||||
- (cd themes/hugo-theme-lowtech && npm i)
|
||||
|
||||
- name: build website
|
||||
image: jakejarvis/hugo-extended
|
||||
commands:
|
||||
- hugo --minify --environment production
|
||||
|
||||
- name: typo
|
||||
image: node:current-alpine
|
||||
commands:
|
||||
- node themes/hugo-theme-lowtech/scripts/typo
|
||||
|
||||
- name: build and push docker image on registry
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username:
|
||||
from_secret: REGISTRY_USER
|
||||
password:
|
||||
from_secret: REGISTRY_PASSWORD
|
||||
repo: registry.weko.io/resilien_fr
|
||||
registry: registry.weko.io
|
||||
tags:
|
||||
- latest
|
||||
|
||||
image_pull_secrets:
|
||||
- REGISTRY_CONFIG
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- main
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: staging
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: install submodule
|
||||
image: drone/git
|
||||
commands:
|
||||
- git submodule update --init
|
||||
|
||||
- name: install npm
|
||||
image: node:current-alpine
|
||||
commands:
|
||||
- (cd themes/hugo-theme-lowtech && npm i)
|
||||
|
||||
- name: build website
|
||||
image: jakejarvis/hugo-extended
|
||||
commands:
|
||||
- hugo --minify --buildDrafts --buildFuture --environment staging
|
||||
|
||||
- name: typo
|
||||
image: node:current-alpine
|
||||
commands:
|
||||
- node themes/hugo-theme-lowtech/scripts/typo
|
||||
|
||||
- name: push docker image on registry
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username:
|
||||
from_secret: REGISTRY_USER
|
||||
password:
|
||||
from_secret: REGISTRY_PASSWORD
|
||||
repo: registry.weko.io/resilien_fr
|
||||
registry: registry.weko.io
|
||||
tags:
|
||||
- staging
|
||||
|
||||
image_pull_secrets:
|
||||
- REGISTRY_CONFIG
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
|
@ -10,11 +10,13 @@ services:
|
|||
resilien-prod:
|
||||
container_name: resilien-prod
|
||||
build: .
|
||||
image: registry.weko.io/resilien_fr:prod
|
||||
restart: always
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.resilien.rule: "Host(`${URL}`)"
|
||||
traefik.http.routers.resilien.entrypoints: "web"
|
||||
com.centurylinklabs.watchtower.enable: true
|
||||
volumes:
|
||||
- resilien-log:/var/log/nginx
|
||||
- resilien-stats:/usr/share/nginx/html/stats
|
||||
|
|
|
@ -8,11 +8,13 @@ services:
|
|||
resilien-staging:
|
||||
container_name: resilien-staging
|
||||
build: .
|
||||
image: registry.weko.io/resilien_fr:staging
|
||||
restart: always
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.resilien-staging.rule: "Host(`staging.${URL}`)"
|
||||
traefik.http.routers.resilien-staging.entrypoints: "web"
|
||||
com.centurylinklabs.watchtower.enable: true
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
|
|
Loading…
Reference in New Issue