mirror of
https://github.com/KevinMidboe/nginx.git
synced 2025-10-29 09:40:26 +00:00
100 lines
2.3 KiB
YAML
100 lines
2.3 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: Build & deploy
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
environment:
|
|
NGINX_VERSION: 1.24.0
|
|
|
|
steps:
|
|
- name: Clone w/ submodules
|
|
image: alpine/git
|
|
commands:
|
|
- git clone $DRONE_REPO_LINK .
|
|
- git checkout $DRONE_COMMIT
|
|
- git submodule update --init --recursive
|
|
|
|
- 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 -I modules-available
|
|
|
|
- name: Verify config post build
|
|
image: ubuntu/nginx:1.24-23.10_beta
|
|
commands:
|
|
- nginx -t
|
|
|
|
- name: Setup credentials
|
|
image: alpine:3.18.4
|
|
commands:
|
|
- mkdir .ssh
|
|
- echo $NGINX_DEPLOY_KEY | base64 -di > .ssh/id_ed25519
|
|
- echo "" >> .ssh/id_ed25519
|
|
- chmod 600 .ssh/id_ed25519
|
|
# - apk update
|
|
# - apk add openssh-client
|
|
# - eval $(ssh-agent -s)
|
|
# - cat .ssh/id_ed25519 | tr -d '\r' | ssh-add - > /dev/null
|
|
# - touch .ssh/known_hosts
|
|
# - ssh-keyscan $NGINX_HOST >> .ssh/known_hosts
|
|
environment:
|
|
NGINX_DEPLOY_KEY:
|
|
from_secret: NGINX_DEPLOY_KEY
|
|
|
|
- name: Deploy
|
|
image: alpine:3.18.4
|
|
commands:
|
|
- apk update
|
|
- apk add rsync openssh
|
|
- rsync
|
|
-av
|
|
-e "ssh -i .ssh/id_ed25519 -o StrictHostKeyChecking=no"
|
|
--exclude available-modules
|
|
modules $NGINX_USER@$NGINX_HOST:/etc/nginx/
|
|
environment:
|
|
NGINX_USER:
|
|
from_secret: NGINX_USER
|
|
NGINX_HOST:
|
|
from_secret: NGINX_HOST
|
|
|
|
|
|
---
|
|
kind: signature
|
|
hmac: 144bbd73dc3b83d6a6f1f4bacca7b83b377b12dc56021db7c723988b0ad2ec3c
|
|
|
|
...
|