27 Commits
Author SHA1 Message Date
cupcakearmy 81a8a76696 split into block and add pr preview 2026-06-25 20:29:26 +01:00
cupcakearmy 99917807f9 maintenance 2026-06-25 20:24:32 +01:00
cupcakearmy cf34f14778 cleanup 2024-07-31 21:17:05 +02:00
cupcakearmy a033f712a1 use bun 2024-07-31 21:10:01 +02:00
cupcakearmyandGitHub 68c487857d Merge pull request #1 from kabaluyot/patch-1
docs: minor typo
2024-01-22 11:02:18 +01:00
Karl Anthony B. BaluyotandGitHub f1cc4805c9 docs: minor typo 2024-01-22 09:23:10 +08:00
cupcakearmyandGitHub 10dd0a9320 delete manual flow 2023-05-02 13:46:17 +02:00
cupcakearmyandGitHub d83ec8b613 Update README.md 2022-11-01 22:37:01 +01:00
cupcakearmyandGitHub 5dec27ab90 Update README.md 2022-11-01 22:35:03 +01:00
cupcakearmy 26f84f4fa7 enable arm and push 2022-11-01 22:10:13 +01:00
cupcakearmy be1f93b028 enable cron job 2022-11-01 22:09:24 +01:00
cupcakearmy 9f7b912536 try with newlinw 2022-11-01 22:05:49 +01:00
cupcakearmy bea16c129b try with comma 2022-11-01 22:01:36 +01:00
cupcakearmy d0cbba385d try with explicit raw 2022-11-01 21:52:58 +01:00
cupcakearmy 2b84c86d45 separate with ; 2022-11-01 21:46:50 +01:00
cupcakearmy 06ca83bb58 try multiple tags 2022-11-01 21:39:50 +01:00
cupcakearmy 574c2b7b87 get latest version 2022-11-01 21:31:31 +01:00
cupcakearmy 22fbf4b955 also arm 2022-11-01 21:14:24 +01:00
cupcakearmy 403c9ad0c6 move to subdirectory 2022-11-01 21:07:58 +01:00
cupcakearmy 6af204ca70 use a min version 2022-11-01 21:03:21 +01:00
cupcakearmy 0324ed6d49 forgot to add output 2022-11-01 20:54:39 +01:00
cupcakearmy 6b5c91d122 formatting 2022-11-01 20:52:37 +01:00
cupcakearmy 9afda15154 set logging and serialize 2022-11-01 20:51:03 +01:00
cupcakearmy 461451257a forgot needs 2022-11-01 20:47:56 +01:00
cupcakearmy 7ebeb907d8 checkout 2022-11-01 20:46:05 +01:00
cupcakearmy 56f983a8e1 matrix build 2022-11-01 20:44:58 +01:00
cupcakearmy b6f2e57965 trial matrix 2022-11-01 20:29:02 +01:00
14 changed files with 284 additions and 46 deletions
+61
View File
@@ -0,0 +1,61 @@
name: Docker Build Reusable
on:
workflow_call:
inputs:
push:
required: false
type: boolean
default: false
nginx_version:
required: true
type: string
tags:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Log in to Docker Hub
uses: docker/login-action@v4
if: inputs.push
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v4
if: inputs.push
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Labels
id: meta
uses: docker/metadata-action@v6
with:
images: |
cupcakearmy/static
ghcr.io/${{ github.repository }}
tags: ${{ inputs.tags }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ inputs.push }}
platforms: linux/amd64,linux/arm64
build-args: NGINX=${{ inputs.nginx_version }}
tags: ${{ steps.meta.outputs.tags }}
+21
View File
@@ -0,0 +1,21 @@
name: Matrix Cron Build
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1'
jobs:
tags:
uses: ./.github/workflows/tags.yml
build:
needs: tags
strategy:
matrix: ${{fromJson(needs.tags.outputs.matrix)}}
uses: ./.github/workflows/build.yml
with:
push: true
nginx_version: ${{ matrix.version }}
tags: ${{ matrix.tags }}
secrets: inherit
-39
View File
@@ -1,39 +0,0 @@
name: docker
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker Labels
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: cupcakearmy/static
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
+18
View File
@@ -0,0 +1,18 @@
name: PR Build
on:
pull_request:
jobs:
tags:
uses: ./.github/workflows/tags.yml
build:
needs: tags
strategy:
matrix: ${{fromJson(needs.tags.outputs.matrix)}}
uses: ./.github/workflows/build.yml
with:
push: false
nginx_version: ${{ matrix.version }}
tags: ${{ matrix.tags }}
+23
View File
@@ -0,0 +1,23 @@
name: Fetch Nginx Tags
on:
workflow_call:
outputs:
matrix:
description: JSON matrix of nginx versions and docker tags
value: ${{ jobs.fetch.outputs.matrix }}
jobs:
fetch:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.fetcher.outputs.matrix }}
defaults:
run:
working-directory: tags
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun i
- id: fetcher
run: bun .
+5 -6
View File
@@ -1,25 +1,24 @@
# BUILDER
FROM alpine AS builder
ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev"
ARG NGINX_MODULES="--with-http_realip_module --with-threads --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_secure_link_module"
ARG NGINX=1.21.6
FROM alpine:3 AS builder
ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev curl"
RUN apk add --no-cache ${DEP_DEV}
WORKDIR /build
ARG NGINX
RUN curl https://nginx.org/download/nginx-${NGINX}.tar.gz | tar xz
RUN mv nginx-${NGINX} nginx
RUN git clone --recursive https://github.com/google/ngx_brotli.git
WORKDIR /build/nginx
ARG NGINX_MODULES="--with-http_realip_module --with-threads --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_secure_link_module"
RUN ./configure ${NGINX_MODULES} --add-module=../ngx_brotli
RUN make
RUN make install
# RUNNER
FROM alpine
FROM alpine:3
ARG DEP_RUN="pcre openssl gd tzdata"
+17 -1
View File
@@ -4,9 +4,25 @@
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/cupcakearmy/static/latest?style=flat-square)
![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/cupcakearmy/static/latest?style=flat-square)
This is a little docker image for histing static content efficiently.
This is a little docker image for hosting static content efficiently.
**Supports ETags & Brotli/GZip** compression out of the box.
Automatically builds the latest mainline and stable releases weekly.
## Features
- Brotli & GZip
- ETag
- No server tokens
## Tags
Tags follow the official nginx naming convention.
- `mainline`, same as `latest`
- `stable`
- Specific version
## Quickstart 🚀
```yaml
+1
View File
@@ -0,0 +1 @@
node_modules
+15
View File
@@ -0,0 +1,15 @@
# tags
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run index.js
```
This project was created using `bun init` in bun v1.1.20. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
+47
View File
@@ -0,0 +1,47 @@
{
"lockfileVersion": 1,
"configVersion": 1,
"workspaces": {
"": {
"dependencies": {
"@actions/core": "latest",
"semver": "latest",
},
"devDependencies": {
"@tsconfig/strictest": "latest",
"@types/bun": "latest",
"@types/semver": "latest",
"typescript": "latest",
},
},
},
"packages": {
"@actions/core": ["@actions/core@3.0.1", "", { "dependencies": { "@actions/exec": "^3.0.0", "@actions/http-client": "^4.0.0" } }, "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA=="],
"@actions/exec": ["@actions/exec@3.0.0", "", { "dependencies": { "@actions/io": "^3.0.2" } }, "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw=="],
"@actions/http-client": ["@actions/http-client@4.0.1", "", { "dependencies": { "tunnel": "^0.0.6", "undici": "^6.23.0" } }, "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg=="],
"@actions/io": ["@actions/io@3.0.2", "", {}, "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw=="],
"@tsconfig/strictest": ["@tsconfig/strictest@2.0.8", "", {}, "sha512-XnQ7vNz5HRN0r88GYf1J9JJjqtZPiHt2woGJOo2dYqyHGGcd6OLGqSlBB6p1j9mpzja6Oe5BoPqWmeDx6X9rLw=="],
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
"@types/node": ["@types/node@26.0.1", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-fc3KiUoBt6kie0N9bIW3E47vZsuaMf0PM2AaUpLCLT0s/LvX1nxAim6Fc049cNxODPpGm6qRAuUOB86SkRuPQw=="],
"@types/semver": ["@types/semver@7.7.1", "", {}, "sha512-FmgJfu+MOcQ370SD0ev7EI8TlCAfKYU+B4m5T3yXc1CiRN94g/SZPtsCkk506aUDtlMnFZvasDwHHUcZUEaYuA=="],
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
"semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
"tunnel": ["tunnel@0.0.6", "", {}, "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="],
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
"undici": ["undici@6.27.0", "", {}, "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg=="],
"undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
}
}
+49
View File
@@ -0,0 +1,49 @@
import { info, setOutput, setFailed } from '@actions/core'
import semver from 'semver'
// Fetch the current versions from the download page
const URL = `https://nginx.org/en/download.html`
const html = await fetch(URL).then((r) => r.text())
// Find all the downloadable versions
const re = /"\/download\/nginx-(\d+\.){3}tar\.gz"/g
const matches = html.match(re)
if (!matches) {
setFailed(`No versions found at ${URL}`)
process.exit(1)
}
// Clean up the matches to semver format
function clean(match: string): string {
return match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '')
}
const versions = matches.map(clean)
// Filter
// Get the two most up to date versions, mainline and stable
const [mainline, stable] = versions.sort(semver.rcompare).slice(0, 2)
if (!mainline || !stable) {
setFailed(`Could not find mainline and stable versions`)
process.exit(1)
}
function convert(version: string, additional: string[] = []) {
return {
version,
// https://github.com/docker/metadata-action#typeraw
tags: [version, ...additional].map((t) => `type=raw,value=${t}`).join('\n'),
}
}
// Export as github action matrix
// https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
const githubActionMatrix = {
include: [convert(mainline, ['latest', 'mainline']), convert(stable, ['stable'])],
}
const serialised = JSON.stringify(githubActionMatrix)
info(`Found ${versions.length} versions`)
info(`Exporting as github action matrix: ${serialised}`)
setOutput('matrix', serialised)
+2
View File
@@ -0,0 +1,2 @@
[tools]
bun = "latest"
+17
View File
@@ -0,0 +1,17 @@
{
"type": "module",
"main": "index.ts",
"scripts": {
"fetch": "bun index.ts"
},
"dependencies": {
"@actions/core": "^3.0.1",
"semver": "^7.8.5"
},
"devDependencies": {
"@tsconfig/strictest": "^2.0.8",
"@types/bun": "^1.3.14",
"@types/semver": "^7.7.1",
"typescript": "^6.0.3"
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "@tsconfig/strictest",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
},
}