[Docker] Create simoncor.net container
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon Cornet 2023-05-24 10:21:58 +02:00
parent b565514636
commit 7f5a0c168b
3 changed files with 70 additions and 69 deletions

View File

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

2
.gitignore vendored
View File

@ -1 +1,3 @@
.hugo_build.lock
public/
resources/

45
Dockerfile.linux.amd64 Normal file
View File

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