File tree 7 files changed +21
-9
lines changed
7 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ ENV HEADERS_MORE_VERSION "v0.33"
7
7
# 1. Installing the headers-more module
8
8
# 2. Adding configuration files needed for proxying private S3 buckets
9
9
# 3. Adding a directory for proxied objects to be stored
10
+ # 4. Replacing the entrypoint script with a modified version that explicitly
11
+ # sets resolvers.
10
12
11
13
RUN set -eux \
12
14
export DEBIAN_FRONTEND=noninteractive; \
@@ -43,11 +45,12 @@ RUN set -eux \
43
45
rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*
44
46
45
47
COPY common/etc /etc
48
+ COPY common/docker-entrypoint.sh /docker-entrypoint.sh
46
49
COPY common/docker-entrypoint.d/00-check-for-required-env.sh /docker-entrypoint.d/00-check-for-required-env.sh
47
50
COPY oss/etc /etc
48
51
49
52
RUN set -eux \
50
53
export DEBIAN_FRONTEND=noninteractive; \
51
54
mkdir -p /var/cache/nginx/s3_proxy; \
52
55
chown nginx:nginx /var/cache/nginx/s3_proxy; \
53
- chmod -R +x /docker-entrypoint.d/*
56
+ chmod -R -v +x /docker-entrypoint.sh /docker-entrypoint. d/*.sh
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ COPY plus/usr /usr
14
14
# Copy files from the OSS NGINX Docker container such that the container
15
15
# startup is the same.
16
16
# Source: https://github.com/nginxinc/docker-nginx/tree/1.19.2/stable/buster
17
- COPY plus /docker-entrypoint.sh /docker-entrypoint.sh
17
+ COPY common /docker-entrypoint.sh /docker-entrypoint.sh
18
18
COPY plus/docker-entrypoint.d /docker-entrypoint.d
19
19
20
20
RUN set -eux \
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ docker build -f Dockerfile.plus -t nginx-plus-s3-gateway --build-arg NGINX_GPGKE
52
52
53
53
Environment variables are used to configure this project.
54
54
55
- * ` AWS_SIGS_VERSION ` - AWS Signatures API version - either 2 or 4 (4 is default)
55
+ * ` AWS_SIGS_VERSION ` - AWS Signatures API version - either 2 or 4 (4 is default)
56
+ * ` DNS_RESOLVERS ` - (optional) DNS resolvers (separated by single spaces) to configure NGINX with
56
57
* ` S3_ACCESS_KEY_ID ` - Access key
57
58
* ` S3_BUCKET_NAME ` - Name of S3 bucket to proxy requests to
58
59
* ` S3_DEBUG ` - Flag (true/false) enabling AWS signatures debug output (default: false)
Original file line number Diff line number Diff line change @@ -81,3 +81,4 @@ echo "Access Key ID: ${S3_ACCESS_KEY_ID}"
81
81
echo " Origin: ${S3_SERVER_PROTO} ://${S3_BUCKET_NAME} .${S3_SERVER} :${S3_SERVER_PORT} "
82
82
echo " Region: ${S3_REGION} "
83
83
echo " AWS Signatures Version: v${AWS_SIGS_VERSION} "
84
+ echo " DNS Resolvers: ${DNS_RESOLVERS} "
Original file line number Diff line number Diff line change 19
19
20
20
set -e
21
21
22
+ # This line is an addition to the NGINX Docker image's entrypoint script.
23
+ if [ -z ${DNS_RESOLVERS+x} ]; then
24
+ export DNS_RESOLVERS=" $( cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2 | xargs) "
25
+ fi
26
+
27
+ # Nothing is modified under this line
28
+
22
29
if [ -z " ${NGINX_ENTRYPOINT_QUIET_LOGS:- } " ]; then
23
30
exec 3>&1
24
31
else
Original file line number Diff line number Diff line change
1
+ # Use NGINX's non-blocking DNS resolution
2
+ resolver ${DNS_RESOLVERS};
3
+
1
4
upstream storage_urls {
2
- # Upstreams are not refrshed until NGINX configuration is reloaded.
5
+ # Upstreams are not refreshed until NGINX configuration is reloaded.
3
6
# NGINX Plus will dynamically reload upstreams when DNS records are changed.
4
7
5
8
# Be sure to specify the port in the S3_SERVER and be sure that port
Original file line number Diff line number Diff line change 1
1
# This configuration with NGINX Plus should dynamically reload S3 backends
2
2
# as they change in DNS.
3
3
4
- # Docker DNS server IP
5
- resolver 127.0.0.11;
6
-
7
- # Public DNS
8
- #resolver 1.1.1.1 8.8.8.8;
4
+ # Use NGINX's non-blocking DNS resolution
5
+ resolver ${DNS_RESOLVERS};
9
6
10
7
upstream storage_urls {
11
8
zone s3_backends 64k;
You can’t perform that action at this time.
0 commit comments