mirror of
https://github.com/cupcakearmy/docker-static.git
synced 2025-09-09 12:10:39 +00:00
Compare commits
25 Commits
v1.21.6
...
cf34f14778
Author | SHA1 | Date | |
---|---|---|---|
cf34f14778 | |||
a033f712a1 | |||
68c487857d | |||
|
f1cc4805c9 | ||
10dd0a9320 | |||
d83ec8b613 | |||
5dec27ab90 | |||
26f84f4fa7 | |||
be1f93b028 | |||
9f7b912536 | |||
bea16c129b | |||
d0cbba385d | |||
2b84c86d45 | |||
06ca83bb58 | |||
574c2b7b87 | |||
22fbf4b955 | |||
403c9ad0c6 | |||
6af204ca70 | |||
0324ed6d49 | |||
6b5c91d122 | |||
9afda15154 | |||
461451257a | |||
7ebeb907d8 | |||
56f983a8e1 | |||
b6f2e57965 |
65
.github/workflows/cron.yml
vendored
Normal file
65
.github/workflows/cron.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: Matrix Cron Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * 1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tags:
|
||||||
|
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 .
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tags
|
||||||
|
strategy:
|
||||||
|
matrix: ${{fromJson(needs.tags.outputs.matrix)}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker Labels
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
cupcakearmy/static
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: ${{ matrix.tags }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
build-args: NGINX=${{ matrix.version }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
39
.github/workflows/docker.yml
vendored
39
.github/workflows/docker.yml
vendored
@@ -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 }}
|
|
@@ -1,18 +1,17 @@
|
|||||||
# BUILDER
|
# BUILDER
|
||||||
FROM alpine AS builder
|
FROM alpine:3 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
|
|
||||||
|
|
||||||
|
ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev curl"
|
||||||
RUN apk add --no-cache ${DEP_DEV}
|
RUN apk add --no-cache ${DEP_DEV}
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
ARG NGINX
|
||||||
RUN curl https://nginx.org/download/nginx-${NGINX}.tar.gz | tar xz
|
RUN curl https://nginx.org/download/nginx-${NGINX}.tar.gz | tar xz
|
||||||
RUN mv nginx-${NGINX} nginx
|
RUN mv nginx-${NGINX} nginx
|
||||||
RUN git clone --recursive https://github.com/google/ngx_brotli.git
|
RUN git clone --recursive https://github.com/google/ngx_brotli.git
|
||||||
|
|
||||||
WORKDIR /build/nginx
|
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 ./configure ${NGINX_MODULES} --add-module=../ngx_brotli
|
||||||
RUN make
|
RUN make
|
||||||
RUN make install
|
RUN make install
|
||||||
|
18
README.md
18
README.md
@@ -4,9 +4,25 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
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.
|
**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 🚀
|
## Quickstart 🚀
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
1
tags/.gitignore
vendored
Normal file
1
tags/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
15
tags/README.md
Normal file
15
tags/README.md
Normal 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.
|
BIN
tags/bun.lockb
Executable file
BIN
tags/bun.lockb
Executable file
Binary file not shown.
49
tags/index.ts
Normal file
49
tags/index.ts
Normal 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)
|
16
tags/package.json
Normal file
16
tags/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "module",
|
||||||
|
"main": "index.ts",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.10.1",
|
||||||
|
"semver": "^7.6.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
|
"@types/bun": "latest",
|
||||||
|
"@types/semver": "^7.5.8"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5.5.4"
|
||||||
|
}
|
||||||
|
}
|
18
tags/tsconfig.json
Normal file
18
tags/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/strictest",
|
||||||
|
"compilerOptions": {
|
||||||
|
// Enable latest features
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true,
|
||||||
|
|
||||||
|
// Bundler mode
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"noEmit": true
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user