Files
nginx/.drone.yml

94 lines
2.1 KiB
YAML

---
kind: pipeline
type: docker
name: Build & deploy
platform:
os: linux
arch: amd64
clone:
disable: true
environment:
NGINX_VERSION: 1.24.0
NGINX_MODULES_DIR: /opt/nginx-modules
HEADERS_MORE_VERSION: 'v0.35'
steps:
- name: Clone w/ submodules
image: alpine/git
commands:
- git clone $DRONE_REPO_LINK .
- git checkout $DRONE_COMMIT
- git submodule update --init --recursive
- ls -l
- name: Verify config
image: ubuntu/nginx:1.24-23.10_beta
commands:
- nginx -t
- name: Compile
image: ubuntu/nginx:1.24-23.10_beta
commands:
- mkdir -p /tmp/nginx-build
- apt update
- apt install -y
wget
build-essential
libpcre3
libpcre3-dev
zlib1g
zlib1g-dev
libssl-dev
tree
- cd /tmp
- wget "http://nginx.org/download/nginx-$${NGINX_VERSION}.tar.gz"
- tar -xvzf nginx-$${NGINX_VERSION}.tar.gz
- cd nginx-$${NGINX_VERSION}
- ./configure --prefix=/tmp/nginx-build
--add-dynamic-module=$DRONE_WORKSPACE/modules-available/headers-more-nginx-module
--with-compat
- make
- make install
- cd $DRONE_WORKSPACE
- mv /tmp/nginx-build/modules/* modules
- tree
- name: Verify config post build
image: ubuntu/nginx:1.24-23.10_beta
commands:
- nginx -t
- name: Setup credentials
image: alpine/git
commands:
- mkdir .ssh
- echo $NGINX_FINGERPRINT | base64 -di > .ssh/known_hosts
- echo $NGINX_DEPLOY_KEY | base64 -di > .ssh/id_ed25519
- echo "" >> .ssh/id_ed25519
- chmod 600 .ssh/id_ed25519
environment:
NGINX_FINGERPRINT:
from_secret: NGINX_FINGERPRINT
NGINX_DEPLOY_KEY:
from_secret: NGINX_DEPLOY_KEY
- name: Deploy
image: alpine/git
commands:
- ssh -i .ssh/id_ed25519 $NGINX_USER@$NGINX_HOST ls
environment:
NGINX_USER:
from_secret: NGINX_USER
NGINX_HOST:
from_secret: NGINX_HOST
---
kind: signature
hmac: 889f2181f1c89b0906b3a95b4fe08fb6a9e91faaf02059c4fe264dac06ce9c1d
...