diff --git a/.drone.yaml b/.drone.yaml index ba78e61..9e6d2fb 100644 --- a/.drone.yaml +++ b/.drone.yaml @@ -1,78 +1,32 @@ --- - -# deployment kind: 'pipeline' -type: 'docker' -name: 'deployment' +name: 'build' +type: 'kubernetes' -# disable clone -clone: - disable: true - -# deployment steps steps: - # simoncor.net deployment - - name: 'rp01 - simoncor.net' - image: 'appleboy/drone-ssh:1.6.3' - settings: +# build and publish +- image: 'docker.io/plugins/docker' + name: 'publish' + pull: 'always' + settings: - # bastion - proxy_host: 'siempie.com' - proxy_port: '22' - proxy_user: - from_secret: 'drone_user' - proxy_key: - from_secret: 'drone_ssh_key' + # registery and repos + registry: 'docker.io' + repo: 'rakepanorama/simoncor-net' + mtu: '1440' - # rp01.siempie.local - host: 'rp01.siempie.local' - port: '22' - user: - from_secret: 'drone_user' - key: - from_secret: 'drone_ssh_key' - script: + # build stuff + dockerfile: 'Dockerfile.linux.amd64' + daemon_off: 'false' - # make sure all is clean - - 'sudo /usr/bin/git -C /var/www/simoncor.net reset --hard HEAD' - - 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fX' - - 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fd' + # authentication + username: + from_secret: 'docker_username' + password: + from_secret: 'docker_password' - # fetch latest checkout - - 'sudo /usr/bin/git -C /var/www/simoncor.net fetch' - - "sudo /usr/bin/git -C /var/www/simoncor.net -c advice.detachedHead=false - checkout '${DRONE_COMMIT_SHA:0:8}'" - - - # simoncor.net deployment - - name: 'rp02 - simoncor.net' - image: 'appleboy/drone-ssh:1.6.3' - settings: - - # bastion - proxy_host: 'siempie.com' - proxy_port: '22' - proxy_user: - from_secret: 'drone_user' - proxy_key: - from_secret: 'drone_ssh_key' - - # rp02.siempie.local - host: 'rp02.siempie.local' - port: '22' - user: - from_secret: 'drone_user' - key: - from_secret: 'drone_ssh_key' - script: - - # make sure all is clean - - 'sudo /usr/bin/git -C /var/www/simoncor.net reset --hard HEAD' - - 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fX' - - 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fd' - - # fetch latest checkout - - 'sudo /usr/bin/git -C /var/www/simoncor.net fetch' - - "sudo /usr/bin/git -C /var/www/simoncor.net -c advice.detachedHead=false - checkout '${DRONE_COMMIT_SHA:0:8}'" + # tags + tags: + - 'v1' + - 'latest' diff --git a/.gitignore b/.gitignore index 2a8645f..21730f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .hugo_build.lock +public/ +resources/ diff --git a/Dockerfile.linux.amd64 b/Dockerfile.linux.amd64 new file mode 100644 index 0000000..036fa57 --- /dev/null +++ b/Dockerfile.linux.amd64 @@ -0,0 +1,45 @@ +FROM ubuntu:latest +ENV DEBIAN_FRONTEND noninteractive + + +# prepare basic stuff +RUN set -e && ln -sf bash /bin/sh +RUN set -e \ + && apt -y update \ + && apt -y upgrade \ + && apt -y install --no-install-recommends --no-install-suggests ca-certificates git wget \ + && apt -y autoremove \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* + + +# install hugo +RUN set -e \ + && wget -q -O /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.112.1/hugo_0.112.1_linux-amd64.deb \ + && apt -y install /tmp/hugo.deb \ + && rm -f /tmp/hugo.deb + +# install static-web-server +RUN set -e \ + && wget -q -O /tmp/sws.tar.gz https://github.com/static-web-server/static-web-server/releases/download/v2.16.0/static-web-server-v2.16.0-x86_64-unknown-linux-gnu.tar.gz \ + && tar -zxf /tmp/sws.tar.gz \ + && mv static-web-server-v2.16.0-x86_64-unknown-linux-gnu/static-web-server /usr/local/bin/sws \ + && rm -rf static-web-server-v* \ + && rm -f /tmp/sws.tar.gz + + +# clone site and template +RUN set -e \ + && git clone --recursive https://git.simoncor.net/siempie/simoncor.net.git /site + +# generate site +RUN set -e \ + && /usr/local/bin/hugo --source=/site/ + + +# expose 80 +EXPOSE 80 + + +# start static-web-server +ENTRYPOINT ["/usr/local/bin/sws", "--host=0.0.0.0", "--log-level=info", "--port=80", "--root=/site/public/"]