Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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"
32 changes: 32 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -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: <target>` 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.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Nginx
<h1 align=center>Dockette / Nginx</h1>

Nginx with SSL / HSTS and HTTP2 module.
<p align=center>
<a href="https://github.com/dockette/nginx/actions"><img src="https://github.com/dockette/nginx/actions/workflows/docker.yml/badge.svg" alt="GitHub Actions"></a>
<a href="https://hub.docker.com/r/dockette/nginx"><img src="https://img.shields.io/docker/pulls/dockette/nginx.svg" alt="Docker Hub pulls"></a>
<a href="https://github.com/sponsors/f3l1x"><img src="https://img.shields.io/badge/sponsor-GitHub%20Sponsors-ea4aaa" alt="GitHub Sponsors"></a>
<a href="https://github.com/orgs/dockette/discussions"><img src="https://img.shields.io/badge/support-discussions-6f42c1" alt="Support/Discussions"></a>
</p>

-----

[![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
<p align=center>
Nginx with SSL / HSTS and HTTP2 module.
</p>

[![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
Expand Down Expand Up @@ -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

Expand Down