replaced gcr.io/distroless/base with scratch, moved to static compilation, added list of image contents to README.md

This commit is contained in:
Ricard Bejarano 2019-02-18 09:46:54 +01:00
parent 23df590c28
commit eff6099ffb
6 changed files with 41 additions and 6 deletions

View file

@ -12,6 +12,8 @@ ARG OPENSSL_CHECKSUM="fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed
ARG NGINX_VERSION="1.15.8"
ARG NGINX_CHECKSUM="a8bdafbca87eb99813ae4fcac1ad0875bf725ce19eb265d28268c309b2b40787"
ARG NGINX_CONFIG="\
--with-cc-opt='-static' \
--with-ld-opt='-static' \
--sbin-path=/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/tmp/nginx.pid \
@ -57,11 +59,15 @@ RUN apt update && \
make
FROM gcr.io/distroless/base
FROM scratch
COPY rootfs /
COPY --from=build /lib/x86_64-linux-gnu/ld-2.24.so /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \
/lib/x86_64-linux-gnu/libc-2.24.so /lib/x86_64-linux-gnu/libc.so.6 \
/lib/x86_64-linux-gnu/libnss_files-2.24.so /lib/x86_64-linux-gnu/libnss_files.so.2 \
/lib/x86_64-linux-gnu/
COPY --from=build /tmp/nginx/objs/nginx /nginx
COPY --from=build /tmp/nginx/html /etc/nginx/html
COPY conf /etc/nginx
ENTRYPOINT ["/nginx", "-g", "daemon off;"]

View file

@ -7,9 +7,9 @@ Available at [`ricardbejarano/nginx`](https://hub.docker.com/r/ricardbejarano/ng
## Features
* Super tiny (only `13MB`)
* Super tiny (only `18MB`)
* Built from source, including libraries
* Based on the official `gcr.io/distroless/base` image
* Based on `scratch`, see [Filesystem](#Filesystem) for an exhaustive list of the image's contents
* Included [TLS1.3](https://tools.ietf.org/html/rfc8446) protocol support (with [OpenSSL](https://www.openssl.org/))
* Included [brotli](https://github.com/google/brotli) compression support (with [ngx_brotli](https://github.com/google/ngx_brotli))
@ -18,9 +18,36 @@ Available at [`ricardbejarano/nginx`](https://hub.docker.com/r/ricardbejarano/ng
Mount your **configuration** on the container's `/etc/nginx` folder.
Mount your **content** on the container's `/etc/nginx/html` folder.
Mount your **web content** on the container's `/etc/nginx/html` folder.
## Filesystem
The image's contents are:
```
/
├── etc/
│ ├── group/
│ ├── nginx/
│ │ ├── html/
│ │ │ ├── 50x.html
│ │ │ └── index.html
│ │ ├── mime.types
│ │ └── nginx.conf
│ └── passwd/
├── lib/
│ └── x86_64-linux-gnu/
│ ├── ld-2.24.so
│ ├── ld-linux-x86-64.so.2 → ld-2.24.so
│ ├── libc-2.24.so
│ ├── libc.so.6 → libc-2.24.so
│ ├── libnss_files-2.24.so
│ └── libnss_files.so.2 → libnss_files-2.24.so
├── nginx
└── tmp/
```
## License
See [LICENSE](https://github.com/ricardbejarano/nginx/blob/master/LICENSE).

1
rootfs/etc/group Normal file
View file

@ -0,0 +1 @@
root:x:0:

1
rootfs/etc/passwd Normal file
View file

@ -0,0 +1 @@
root:x:0:0:root:/:/nginx