Adding release notes and weekly build support (to pull latest nginx release)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Unprivileged Nginx Redirect Docker Image
|
||||
|
||||
[](https://ci.mrose.cloud/vincent/redirect)
|
||||
|
||||
A lightweight, secure, and reusable Docker image based on `nginxinc/nginx-unprivileged:alpine-slim` designed to redirect HTTP requests to any configurable target domain/path with customizable HTTP status codes.
|
||||
|
||||
It is designed to be built via **Drone CI** directly onto the host server's Docker daemon, allowing multiple containers to run on the host system using the single tagged image.
|
||||
@@ -42,16 +44,34 @@ steps:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
commands:
|
||||
- docker build -t redirect:latest .
|
||||
- docker build --pull -t redirect:latest .
|
||||
- |
|
||||
if [ -n "$DRONE_COMMIT_SHA" ]; then
|
||||
SHORT_SHA=$(echo $DRONE_COMMIT_SHA | cut -c1-7)
|
||||
docker tag redirect:latest redirect:$SHORT_SHA
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DRONE_TAG" ]; then
|
||||
docker tag redirect:latest redirect:$DRONE_TAG
|
||||
fi
|
||||
- |
|
||||
apk add --no-cache git 2>/dev/null || true
|
||||
git fetch --tags 2>/dev/null || true
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
|
||||
if [ -n "$LATEST_TAG" ]; then
|
||||
docker tag redirect:latest redirect:$LATEST_TAG
|
||||
fi
|
||||
|
||||
volumes:
|
||||
- name: dockersock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
- cron
|
||||
```
|
||||
|
||||
> **Note**: Ensure your Drone runner environment allows mounting the host socket volume.
|
||||
@@ -72,6 +92,16 @@ git push origin v1.0.0
|
||||
2. Drone automatically populates `$DRONE_TAG` with the tag value (e.g. `v1.0.0`) and triggers the pipeline.
|
||||
3. The pipeline builds and tags the host image as `redirect:v1.0.0` (as well as `redirect:latest` and `redirect:<short_sha>`).
|
||||
|
||||
### Weekly Scheduled Rebuilds (`weekly-build`)
|
||||
|
||||
To keep your Docker images updated with upstream OS/Nginx security patches:
|
||||
|
||||
1. In the **Drone CI UI** (or via Drone CLI), navigate to **Repository Settings** -> **Cron Jobs**.
|
||||
2. Add a new Cron job named `weekly-build` set to trigger weekly (e.g., `@weekly` or `0 0 * * 0`).
|
||||
3. When the `cron` event triggers:
|
||||
- The pipeline executes `docker build --pull -t redirect:latest .` to fetch updated base layers from Alpine/Nginx.
|
||||
- It fetches the latest Git release tag (`git describe --tags --abbrev=0`) and automatically updates `redirect:<latest_tag>` (e.g., `redirect:v1.0.0`) on the host daemon.
|
||||
|
||||
---
|
||||
|
||||
## Quick Start & Usage
|
||||
|
||||
Reference in New Issue
Block a user