Skip to content

Commit 989990c

Browse files
committed
Use here-documents style in Dockerfile
1 parent 388fa7e commit 989990c

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
sed -i "17i && sed -i 's|pkgs|pkgs-test|g' /etc/apt/apt.conf.d/90pkgs-nginx \\\ " docker/Dockerfile
4545
sed -i 's|deb https|deb [trusted=yes] https|g' docker/Dockerfile
4646
sed -i 's|nginx-plus-\${{ env.NGINX_PLUS_VERSION }}|nginx-plus|g' docker/Dockerfile
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v1
4749
- name: Build Plus Docker Image
4850
uses: docker/build-push-action@v2
4951
with:

docker/Dockerfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.3
1+
# syntax=docker/dockerfile:1.4
22
FROM debian:bullseye-slim
33

44
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
@@ -8,20 +8,21 @@ ARG NGINX_PLUS_VERSION
88
# Install NGINX Plus
99
# Download certificate and key from the customer portal (https://my.f5.com)
1010
# and copy to the build context
11-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1211
RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
1312
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
14-
apt-get update \
15-
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl apt-transport-https \
16-
&& curl -sSL https://cs.nginx.com/static/keys/nginx_signing.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_signing.gpg \
17-
&& curl -sSL -o /etc/apt/apt.conf.d/90pkgs-nginx https://cs.nginx.com/static/files/90pkgs-nginx \
18-
&& DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release) \
19-
&& printf "%s\n" "deb https://pkgs.nginx.com/plus/${NGINX_PLUS_VERSION^^}/debian ${DEBIAN_VERSION} nginx-plus" > /etc/apt/sources.list.d/nginx-plus.list \
20-
&& apt-get update && apt-get install -y nginx-plus-${NGINX_PLUS_VERSION} \
21-
&& apt-get remove --purge --auto-remove -y gnupg \
22-
&& rm -rf /var/lib/apt/lists/* \
23-
&& rm /etc/apt/apt.conf.d/90pkgs-nginx /etc/apt/sources.list.d/nginx-plus.list
24-
13+
<<"eot" bash -euo pipefail
14+
apt-get update
15+
apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl apt-transport-https
16+
curl -fsSL https://cs.nginx.com/static/keys/nginx_signing.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_signing.gpg
17+
curl -fsSL -o /etc/apt/apt.conf.d/90pkgs-nginx https://cs.nginx.com/static/files/90pkgs-nginx
18+
DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release)
19+
printf "%s\n" "deb https://pkgs.nginx.com/plus/${NGINX_PLUS_VERSION^^}/debian ${DEBIAN_VERSION} nginx-plus" > /etc/apt/sources.list.d/nginx-plus.list
20+
apt-get update
21+
apt-get install -y nginx-plus-${NGINX_PLUS_VERSION}
22+
apt-get remove --purge --auto-remove -y gnupg
23+
rm -rf /var/lib/apt/lists/*
24+
rm /etc/apt/apt.conf.d/90pkgs-nginx /etc/apt/sources.list.d/nginx-plus.list
25+
eot
2526

2627
# Forward request logs to Docker log collector
2728
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
@@ -32,7 +33,7 @@ EXPOSE 80
3233
STOPSIGNAL SIGQUIT
3334

3435
RUN rm -rf /etc/nginx/conf.d/*
35-
COPY test.conf /etc/nginx/conf.d/
36-
COPY nginx.conf /etc/nginx/
36+
COPY --link test.conf /etc/nginx/conf.d/
37+
COPY --link nginx.conf /etc/nginx/
3738

3839
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)