diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..9f82f13 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,62 @@ +name: "Docker" + +on: + workflow_dispatch: + + push: + branches: ["master"] + + schedule: + - cron: "0 8 * * 1" + +permissions: + contents: read + +jobs: + test: + name: "Test" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v3 + + - name: "Build image" + uses: docker/build-push-action@v6 + with: + context: "." + load: true + tags: "dockette/nginx:latest" + + - name: "Test image" + run: "make test" + + build: + name: "Build" + needs: ["test"] + uses: dockette/.github/.github/workflows/docker.yml@master + secrets: inherit + with: + image: "dockette/nginx" + tag: "latest" + context: "." + + docs: + name: "Docs" + runs-on: "ubuntu-latest" + needs: ["build"] + if: github.ref == 'refs/heads/master' + + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Update Docker Hub description" + uses: peter-evans/dockerhub-description@v5 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: "dockette/nginx" diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..fb01895 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,32 @@ +# AGENTS.md + +## Project + +Dockette Nginx builds `dockette/nginx`, an Nginx image with SSL, HSTS, HTTP/2-oriented configuration, custom global config includes, site fragments, and Diffie-Hellman parameter files. + +## Images + +- Default image: `dockette/nginx:latest`. +- Build context: repository root `.` with `Dockerfile`, `nginx.conf`, `mime.types`, `conf.d/`, `site.conf.d/`, `sites.d/`, and DH parameter files. +- Base image: `dockette/stretch`. +- GitHub Actions tests `linux/amd64`, then publishes `linux/amd64,linux/arm64` through the shared Dockette Docker workflow on `master` and the weekly schedule. + +## Commands + +- `make build` builds `${DOCKER_IMAGE}:${DOCKER_TAG}` from `.`. +- `make test` runs `nginx -v` and validates the generated Nginx configuration with `nginx -t`. +- `make run` starts the image locally on `80:80` and `443:443`. + +## Testing Notes + +- Prefer `make test` after Dockerfile or Nginx configuration changes. +- Use `make -n build test run` to dry-run command wiring without requiring Docker. +- The smoke test requires Docker and a locally built `${DOCKER_IMAGE}:${DOCKER_TAG}` image. + +## Guidelines + +- Keep `Dockerfile`, `Makefile`, README, Nginx config files, and `.github/workflows/docker.yml` aligned. +- Prefer `DOCKER_*` names for Docker-related Makefile variables. +- Place `.PHONY: ` directly above each Makefile target. +- Keep README badges and maintenance sections consistent with other Dockette image repos. +- Do not introduce unrelated formatting or structural changes. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Dockerfile b/Dockerfile index ebae411..ea329f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN apt-get update && apt-get dist-upgrade -y && \ nginx-module-njs \ gettext-base && \ rm /etc/nginx/conf.d/default.conf && \ + mkdir -p /etc/nginx/user.conf.d && \ ln -sf /dev/stdout /var/log/nginx/access.log && \ ln -sf /dev/stderr /var/log/nginx/error.log && \ # CLEANING PART diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8b919c1 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +DOCKER_IMAGE=dockette/nginx +DOCKER_TAG?=latest +DOCKER_PLATFORMS?=linux/amd64,linux/arm64 + +.PHONY: build +build: + docker buildx build --platform ${DOCKER_PLATFORMS} -t ${DOCKER_IMAGE}:${DOCKER_TAG} . + +.PHONY: test +test: + docker run --rm ${DOCKER_IMAGE}:${DOCKER_TAG} nginx -v + docker run --rm ${DOCKER_IMAGE}:${DOCKER_TAG} nginx -t + +.PHONY: run +run: + docker run --rm -it -p 80:80 -p 443:443 ${DOCKER_IMAGE}:${DOCKER_TAG} diff --git a/README.md b/README.md index a00c5f1..3746a5b 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -# Nginx +

Dockette / Nginx

-Nginx with SSL / HSTS and HTTP2 module. +

+ GitHub Actions + Docker Hub pulls + GitHub Sponsors + Support/Discussions +

------ - -[![Docker Stars](https://img.shields.io/docker/stars/dockette/nginx.svg?style=flat)](https://hub.docker.com/r/dockette/nginx/) -[![Docker Pulls](https://img.shields.io/docker/pulls/dockette/nginx.svg?style=flat)](https://hub.docker.com/r/dockette/nginx/) - -## Discussion / Help +

+ Nginx with SSL / HSTS and HTTP2 module. +

-[![Join the chat](https://img.shields.io/gitter/room/dockette/dockette.svg?style=flat-square)](https://gitter.im/dockette/dockette?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +----- ## Default -Without any volumes Nginx listen IPv4 and IPv6 on both ports 80/443 and serve 444 No content. +Without any custom site configuration, Nginx starts with no default virtual host. Mount a server configuration into `/etc/nginx/sites.d` to listen on ports 80/443. ## Usage ```sh docker run \ - -p 80:80 \ - -p 443:433 \ + -p 80:80 \ + -p 443:443 \ -v /path/to/site:/etc/nginx/sites.d/site \ --name nginx \ dockette/nginx:latest @@ -65,11 +67,7 @@ Take a look at [nginx.conf](https://github.com/dockette/nginx/blob/master/nginx. Sites are loaded from folder `/etc/nginx/sites.d`. -There are 2 sites predefined: - -The [default](https://github.com/dockette/nginx/blob/master/sites.d/default) returns http code 444 for every requests, it's marked as `default_server`. - -And the [example](https://github.com/dockette/nginx/blob/master/.examples) site. +The image ships an empty `/etc/nginx/sites.d` folder. Example site configurations are available in [.examples/sites.d](https://github.com/dockette/nginx/tree/master/.examples/sites.d), including a 444 `default_server`, but they are not installed automatically. ### Sites config