docker-compose deployment #18

Merged
wanderer merged 6 commits from docker-deploy into master 2020-10-03 21:00:22 +02:00
5 changed files with 141 additions and 17 deletions

@ -6,6 +6,10 @@ name: pull
clone: clone:
disable: true disable: true
trigger:
event:
exclude: [push, pull_request]
steps: steps:
- name: fedora-hugo - name: fedora-hugo
pull: always pull: always
@ -30,6 +34,10 @@ platform:
os: linux os: linux
arch: amd64 arch: amd64
trigger:
branch: [master, testing]
event: pull_request
depends_on: depends_on:
- pull - pull
@ -37,23 +45,48 @@ steps:
- name: hugo-extended - name: hugo-extended
pull: if-not-exists pull: if-not-exists
image: immawanderer/fedora-hugo:latest image: immawanderer/fedora-hugo:latest
when:
branch:
- master
event:
- push
- pull_request
commands: commands:
- git submodule init - git submodule init
- git submodule update - git submodule update
- hugo version - hugo version
- hugo --gc=true --minify - 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 kind: pipeline
type: docker type: docker
name: deploy name: deploy-staging
platform: platform:
os: linux os: linux
@ -61,12 +94,9 @@ platform:
trigger: trigger:
branch: branch:
- master
- testing - testing
event: event:
exclude: exclude: [pull_request, tag]
- pull_request
- tag
depends_on: depends_on:
- build - build
@ -88,7 +118,7 @@ steps:
status: status:
- success - success
branch: branch:
- master - testing
depends_on: depends_on:
- hugo-extended - hugo-extended
environment: environment:
@ -104,6 +134,63 @@ steps:
- rsync -av --delete --chown $OL public/ $OL@dotya.ml:$OL_D - 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 kind: pipeline
name: notifications name: notifications
@ -118,7 +205,7 @@ clone:
trigger: trigger:
branch: branch:
- master - master
- "*" - testing
event: event:
- push - push
- tag - tag
@ -126,8 +213,7 @@ trigger:
- success - success
- failure - failure
depends_on: depends_on: [deploy, deploy-staging]
- deploy
steps: steps:
- name: discord - name: discord

15
Dockerfile Normal file

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

@ -1,4 +1,4 @@
baseurl = "https://dotya.ml" baseurl = "/"
languageCode = "en-us" languageCode = "en-us"
defaultContentLanguage = "en" defaultContentLanguage = "en"
theme = "hermit" theme = "hermit"

23
docker-compose.yml Normal file

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

@ -1,3 +1,3 @@
<footer id="site-footer" class="section-inner thin animated fadeIn faster"> <footer id="site-footer" class="section-inner thin animated fadeIn faster">
<p>&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }} &#183 <a href="https://git.dotya.ml/dotya.ml/homepage" title="source code" target="_blank" rel="noopener">source</a> &#183 <a href="https://status.dotya.ml" title="service status" target="_blank" rel="noopener">status</a><br/><a href="https://git.dotya.ml/dotya.ml/homepage/commit/{{ .GitInfo.Hash }}" target="_blank" rel="noopener">commit {{ .GitInfo.AbbreviatedHash }}</a></p> <p>&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }} &#183 <a href="https://git.dotya.ml/dotya.ml/homepage" title="source code" target="_blank" rel="noopener">source</a> &#183 <a href="https://status.dotya.ml" title="service status" target="_blank" rel="noopener">status</a>{{if .Site.Params.enableGitInfo}}<br/><a href="https://git.dotya.ml/dotya.ml/homepage/commit/{{ .GitInfo.Hash }}" target="_blank" rel="noopener">commit {{ .GitInfo.AbbreviatedHash }}</a>{{end}}</p>
</footer> </footer>