diff --git a/.drone.yml b/.drone.yml index cd600fc..100f5f1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,6 +6,10 @@ name: pull clone: disable: true +trigger: + event: + exclude: [push, pull_request] + steps: - name: fedora-hugo pull: always @@ -30,6 +34,10 @@ platform: os: linux arch: amd64 +trigger: + branch: [master, testing] + event: pull_request + depends_on: - pull @@ -37,23 +45,48 @@ steps: - name: hugo-extended pull: if-not-exists image: immawanderer/fedora-hugo:latest - when: - branch: - - master - event: - - push - - pull_request commands: - git submodule init - git submodule update - hugo version - hugo --gc=true --minify +--- +kind: pipeline +type: docker +name: docker-compose-build + +platform: + os: linux + arch: amd64 + +trigger: + branch: master + event: pull_request + +depends_on: +- build + +steps: +- name: build + pull: always + image: tmaier/docker-compose:latest + volumes: + - name: s + path: /var/run/docker.sock + commands: + - docker-compose build + +volumes: +- name: s + host: + path: /var/run/docker.sock + --- kind: pipeline type: docker -name: deploy +name: deploy-staging platform: os: linux @@ -61,12 +94,9 @@ platform: trigger: branch: - - master - testing event: - exclude: - - pull_request - - tag + exclude: [pull_request, tag] depends_on: - build @@ -88,7 +118,7 @@ steps: status: - success branch: - - master + - testing depends_on: - hugo-extended environment: @@ -104,6 +134,63 @@ steps: - rsync -av --delete --chown $OL public/ $OL@dotya.ml:$OL_D +--- +kind: pipeline +type: docker +name: deploy + +platform: + os: linux + arch: amd64 + +trigger: + branch: + - master + event: + exclude: [pull_request, tag] + +depends_on: +- build + +steps: +- name: hugo-extended + pull: if-not-exists + image: immawanderer/fedora-hugo:latest + commands: + - git submodule init + - git submodule update + - hugo version + - hugo --gc=true --minify + +- name: rm-intermediate + pull: if-not-exists + image: immawanderer/fedora-hugo:latest + depends_on: + - hugo-extended + commands: + - rm -rf ./public + +- name: build + pull: always + image: tmaier/docker-compose:latest + depends_on: + - rm-intermediate + volumes: + - name: s + path: /var/run/docker.sock + commands: + - docker stop homepage || true + - docker-compose up --build -d + when: + branch: master + status: success + +volumes: +- name: s + host: + path: /var/run/docker.sock + + --- kind: pipeline name: notifications @@ -118,7 +205,7 @@ clone: trigger: branch: - master - - "*" + - testing event: - push - tag @@ -126,8 +213,7 @@ trigger: - success - failure -depends_on: -- deploy +depends_on: [deploy, deploy-staging] steps: - name: discord diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e874692 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM immawanderer/fedora-hugo:latest +RUN mkdir -pv /homepage +COPY . /homepage + +WORKDIR /homepage + +RUN git submodule init \ +&& git submodule update --recursive \ +&& hugo version +RUN hugo --minify --gc=true + +WORKDIR / + +FROM nginx +COPY --from=0 /homepage/public/ /usr/share/nginx/html diff --git a/config.toml b/config.toml index 63c29be..5e15c1d 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -baseurl = "https://dotya.ml" +baseurl = "/" languageCode = "en-us" defaultContentLanguage = "en" theme = "hermit" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..efb8091 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + homepage: + container_name: homepage + build: + context: . + image: homepage + networks: + - default + restart: unless-stopped + ports: + - "127.0.0.1:1314:80" + environment: + - ENABLE_IPV6=true + volumes: + - "/var/run/docker.sock:/tmp/docker.sock:ro" + labels: + "homepage": "true" + logging: + driver: json-file + options: + max-size: "5m" + max-file: "5" diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e3a1474..90069af 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,3 +1,3 @@