|
Human Made Docker Nginx Container Docker configuration for building a Nginx container | |
| A Human Made project. Maintained by @nathanielks and @joehoyle. |
|
The image expects the application it is serving to be mounted as a volume to /usr/src/app. This container communicates only via HTTPS over port 8080. The SSL certificate is baked into the image for simplicity. This could be updated to have the certificate provisioned at run-time, if we so chose.
In order to facilitate backporting non-breaking changes across various minor versions, we use the following branching and build strategy:
master branch tracks the latest stable changes. It is not built.v<major>.<minor>-branch (eg v3.0-branch, v3.1-branch, etc) are the authoritative source for that version. These branches are built.When submitting pull requests, use master as the base branch and add labels for Backport bot to merge changes into the desired version branches. For instance, when changes need to be made to the 3.0 version branch, use master as the Pull Request base branch and add the backport v3.0-branch label to the Pull Request.
In the event Backport is unable to apply changes to an older version branch, you will need to submit a Pull Request to the version branch directly.
This container inherits from the Official Nginx container's Alpine variant. The Dockerfile is configured to allow Docker build arguments to define which version of Nginx you wish to install. Should you wish to specify a different version than the default of 1.15, you can add a build argument like so:
docker build --build-arg FROM_NGINX=.1.15.6 -t nginx .
This will select the 1.15.6 tag. The FROM definition is dynamic:
ARG FROM_NGINX=1.15
FROM nginx:${FROM_NGINX}-alpine
Gzip is disabled by default in favour of brotli compression via Cloudfront. Should you wish to enable gzip for local development you can add an ENV Variable when you run the container like so:
docker run -d -p 8080 -v $(pwd)/test/urls:/usr/src/app --env GZIP_STATUS=on --name nginx-test docker-wordpress-nginx
You can view the list of tags for the Official Nginx Container here.
This uses inspec as a testing framework. To install inspec, follow their installation guide. The tests expect an environment variable BASE_URL in the format <protocol>://<host:port> in order to perform the http requests. This means you will need to run a built version of the nginx container and provide its URL to the test suite, like so:
docker build -t docker-wordpress-nginx .
docker run -d -p 8080 -v $(pwd)/test/urls:/usr/src/app --name nginx-test docker-wordpress-nginx
export BASE_URL="https://127.0.0.1:$(docker inspect $(docker ps -q --filter name=nginx-test --latest) --format='{{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}}')"
inspec exec test/inspec/nginx --reporter cli junit:/tmp/test-results/inspec/junit.xml --chef-license accept
Content type
Image
Digest
sha256:2991d0b5f…
Size
27.5 MB
Last updated
13 days ago
docker pull humanmade/altis-local-server-nginx:pull-request-141