[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' kind: 'pipeline'
type: 'docker' name: 'build'
name: 'deployment' type: 'kubernetes'
# disable clone
clone:
disable: true
# deployment steps
steps: steps:
# simoncor.net deployment # build and publish
- name: 'rp01 - simoncor.net' - image: 'docker.io/plugins/docker'
image: 'appleboy/drone-ssh:1.6.3' name: 'publish'
pull: 'always'
settings: settings:
# bastion # registery and repos
proxy_host: 'siempie.com' registry: 'docker.io'
proxy_port: '22' repo: 'rakepanorama/simoncor-net'
proxy_user: mtu: '1440'
from_secret: 'drone_user'
proxy_key:
from_secret: 'drone_ssh_key'
# rp01.siempie.local # build stuff
host: 'rp01.siempie.local' dockerfile: 'Dockerfile.linux.amd64'
port: '22' daemon_off: 'false'
user:
from_secret: 'drone_user'
key:
from_secret: 'drone_ssh_key'
script:
# make sure all is clean # authentication
- 'sudo /usr/bin/git -C /var/www/simoncor.net reset --hard HEAD' username:
- 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fX' from_secret: 'docker_username'
- 'sudo /usr/bin/git -C /var/www/simoncor.net clean -fd' password:
from_secret: 'docker_password'
# fetch latest checkout # tags
- 'sudo /usr/bin/git -C /var/www/simoncor.net fetch' tags:
- "sudo /usr/bin/git -C /var/www/simoncor.net -c advice.detachedHead=false - 'v1'
checkout '${DRONE_COMMIT_SHA:0:8}'" - 'latest'
# 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}'"

2
.gitignore vendored
View File

@ -1 +1,3 @@
.hugo_build.lock .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/"]