style and format changes (indent issue)

This commit is contained in:
ElevenNotes
2023-05-23 15:11:24 +02:00
parent e2aa2e9a18
commit 7df68db7c4
4 changed files with 331 additions and 339 deletions

View File

@@ -1,32 +1,21 @@
# docker-nginx
Dockerfile to create and run your own nginx process inside an alpine docker container. Nginx is compiled from source and currently has one added optional module.
Container to run your own nginx process inside an alpine docker container. Nginx is compiled from source and currently has additional modules.
## Volumes
/nginx/etc
Purpose: vHost config, must end in *.conf (set in /etc/nginx/nginx.conf)
/nginx/www
Purpose: Webroot for vHost
/nginx/ssl
Purpose: SSL certificate directory
* **/nginx/etc** - vHost config, must end in *.conf (set in /etc/nginx/nginx.conf)
* **/nginx/www** - Webroot for vHost
* **/nginx/ssl** - SSL certificate directory
## Run
```shell
docker run --name nginx \
-v volume-etc:/nginx/etc \
-v volume-www:/nginx/www \
-v volume-ssl:/nginx/ssl:ro \
-d 11notes/nginx:[tag]
-v /local/etc:/nginx/etc \
-v /local/www:/nginx/www \
-v /local/ssl:/nginx/ssl:ro \
-d 11notes/nginx:[tag]
```
## difference between official docker images
Additional plugins:
```shell
@@ -34,19 +23,16 @@ Additional plugins:
```
Nginx configuration:
```shell
all data moved to /nginx (in compiler!)
```
## Docker -u 1000:1000 (no root initiative)
As part to make containers more secure, this container will not run as root, but as uid:gid 1000:1000. Therefore the default TCP port 80 was changed to 8080.
As part to make containers more secure, this container will not run as root, but as uid:gid 1000:1000. Therefore the default TCP port 80 was changed to 8080 (/source/default.conf).
## Build with
* [Alpine Linux](https://alpinelinux.org/) - Alpine Linux
* [nginx](https://github.com/nginxinc/docker-nginx) - Nginx
## Built with
* [Alpine Linux](https://alpinelinux.org/) - Offical Parent Container
* [nginx](https://nginx.org/) - Nginx
## Tips

View File

@@ -68,6 +68,7 @@
bash \
alpine-sdk \
findutils; \
apk upgrade; \
mkdir -p /usr/lib/nginx/modules; \
mkdir -p /usr/src; \
curl -SL https://github.com/openresty/headers-more-nginx-module/archive/v${MODULE_HEADERS_MORE_NGINX_VERSION}.tar.gz | tar -zxC /usr/lib/nginx/modules; \
@@ -106,13 +107,14 @@
mkdir -p /nginx/www; \
mkdir -p /nginx/ssl; \
mkdir -p /nginx/cache; \
mkdir -p /nginx/run;
mkdir -p /nginx/run; \
mkdir -p /var/log/nginx;
RUN set -ex; \
apk add --update --no-cache \
curl \
pcre2-dev; \
mkdir -p /var/log/nginx; \
apk upgrade; \
touch /var/log/nginx/access.log; \
touch /var/log/nginx/error.log; \
ln -sf /dev/stdout /var/log/nginx/access.log; \
@@ -124,6 +126,8 @@
# :: copy root filesystem changes
COPY ./rootfs /
RUN set -ex; \
chmod +x -R /usr/local/bin;
# :: docker -u 1000:1000 (no root initiative)
RUN set -ex; \
@@ -135,10 +139,8 @@
VOLUME ["/nginx/etc", "/nginx/www", "/nginx/ssl"]
# :: Monitor
RUN set -ex; chmod +x /usr/local/bin/healthcheck.sh
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh || exit 1
# :: Start
RUN set -ex; chmod +x /usr/local/bin/entrypoint.sh
USER nginx
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View File

@@ -6,8 +6,8 @@
# :: Builder
FROM arm32v7/alpine:latest as build
COPY --from=qemu qemu-arm-static /usr/bin
ENV NGINX_VERSION 1.24.0
ENV ADD_MODULE_HEADERS_MORE_NGINX_VERSION 0.34
ENV NGINX_VERSION=1.24.0
ENV MODULE_HEADERS_MORE_NGINX_VERSION=0.34
RUN set -ex; \
CONFIG="\
@@ -54,7 +54,7 @@
--with-compat \
--with-file-aio \
--with-http_v2_module \
--add-module=/usr/lib/nginx/modules/headers-more-nginx-module-$ADD_MODULE_HEADERS_MORE_NGINX_VERSION \
--add-module=/usr/lib/nginx/modules/headers-more-nginx-module-${MODULE_HEADERS_MORE_NGINX_VERSION} \
"; \
apk add --no-cache --update \
curl \
@@ -74,11 +74,12 @@
bash \
alpine-sdk \
findutils; \
apk upgrade; \
mkdir -p /usr/lib/nginx/modules; \
mkdir -p /usr/src; \
curl -SL https://github.com/openresty/headers-more-nginx-module/archive/v$ADD_MODULE_HEADERS_MORE_NGINX_VERSION.tar.gz | tar -zxC /usr/lib/nginx/modules; \
curl -SL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar -zxC /usr/src; \
cd /usr/src/nginx-$NGINX_VERSION; \
curl -SL https://github.com/openresty/headers-more-nginx-module/archive/v${MODULE_HEADERS_MORE_NGINX_VERSION}.tar.gz | tar -zxC /usr/lib/nginx/modules; \
curl -SL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -zxC /usr/src; \
cd /usr/src/nginx-${NGINX_VERSION}; \
./configure $CONFIG --with-debug; \
make -j $(nproc); \
mv objs/nginx objs/nginx-debug; \
@@ -113,13 +114,14 @@
mkdir -p /nginx/www; \
mkdir -p /nginx/ssl; \
mkdir -p /nginx/cache; \
mkdir -p /nginx/run;
mkdir -p /nginx/run; \
mkdir -p /var/log/nginx;
RUN set -ex; \
apk add --update --no-cache \
curl \
pcre2-dev; \
mkdir -p /var/log/nginx; \
apk upgrade; \
touch /var/log/nginx/access.log; \
touch /var/log/nginx/error.log; \
ln -sf /dev/stdout /var/log/nginx/access.log; \
@@ -131,6 +133,8 @@
# :: copy root filesystem changes
COPY ./rootfs /
RUN set -ex; \
chmod +x -R /usr/local/bin;
# :: docker -u 1000:1000 (no root initiative)
RUN set -ex; \
@@ -142,10 +146,8 @@
VOLUME ["/nginx/etc", "/nginx/www", "/nginx/ssl"]
# :: Monitor
RUN set -ex; chmod +x /usr/local/bin/healthcheck.sh
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh || exit 1
# :: Start
RUN set -ex; chmod +x /usr/local/bin/entrypoint.sh
USER nginx
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View File

@@ -6,8 +6,8 @@
# :: Builder
FROM arm64v8/alpine:latest as build
COPY --from=qemu qemu-aarch64-static /usr/bin
ENV NGINX_VERSION 1.24.0
ENV ADD_MODULE_HEADERS_MORE_NGINX_VERSION 0.34
ENV NGINX_VERSION=1.24.0
ENV MODULE_HEADERS_MORE_NGINX_VERSION=0.34
RUN set -ex; \
CONFIG="\
@@ -54,7 +54,7 @@
--with-compat \
--with-file-aio \
--with-http_v2_module \
--add-module=/usr/lib/nginx/modules/headers-more-nginx-module-$ADD_MODULE_HEADERS_MORE_NGINX_VERSION \
--add-module=/usr/lib/nginx/modules/headers-more-nginx-module-${MODULE_HEADERS_MORE_NGINX_VERSION} \
"; \
apk add --no-cache --update \
curl \
@@ -74,11 +74,12 @@
bash \
alpine-sdk \
findutils; \
apk upgrade; \
mkdir -p /usr/lib/nginx/modules; \
mkdir -p /usr/src; \
curl -SL https://github.com/openresty/headers-more-nginx-module/archive/v$ADD_MODULE_HEADERS_MORE_NGINX_VERSION.tar.gz | tar -zxC /usr/lib/nginx/modules; \
curl -SL https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | tar -zxC /usr/src; \
cd /usr/src/nginx-$NGINX_VERSION; \
curl -SL https://github.com/openresty/headers-more-nginx-module/archive/v${MODULE_HEADERS_MORE_NGINX_VERSION}.tar.gz | tar -zxC /usr/lib/nginx/modules; \
curl -SL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -zxC /usr/src; \
cd /usr/src/nginx-${NGINX_VERSION}; \
./configure $CONFIG --with-debug; \
make -j $(nproc); \
mv objs/nginx objs/nginx-debug; \
@@ -113,13 +114,14 @@
mkdir -p /nginx/www; \
mkdir -p /nginx/ssl; \
mkdir -p /nginx/cache; \
mkdir -p /nginx/run;
mkdir -p /nginx/run; \
mkdir -p /var/log/nginx;
RUN set -ex; \
apk add --update --no-cache \
curl \
pcre2-dev; \
mkdir -p /var/log/nginx; \
apk upgrade; \
touch /var/log/nginx/access.log; \
touch /var/log/nginx/error.log; \
ln -sf /dev/stdout /var/log/nginx/access.log; \
@@ -131,6 +133,8 @@
# :: copy root filesystem changes
COPY ./rootfs /
RUN set -ex; \
chmod +x -R /usr/local/bin;
# :: docker -u 1000:1000 (no root initiative)
RUN set -ex; \
@@ -142,10 +146,8 @@
VOLUME ["/nginx/etc", "/nginx/www", "/nginx/ssl"]
# :: Monitor
RUN set -ex; chmod +x /usr/local/bin/healthcheck.sh
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh || exit 1
# :: Start
RUN set -ex; chmod +x /usr/local/bin/entrypoint.sh
USER nginx
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]