Skip to content

Commit 44a795c

Browse files
committed
Restructured docker images heirarchy
1 parent 30e4dce commit 44a795c

File tree

9 files changed

+239
-99
lines changed

9 files changed

+239
-99
lines changed

.jenkins/Jenkinsfile

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ pipeline {
2828
}
2929
steps {
3030
script {
31-
env.BASE_TAG = 'latest'
32-
env.BUILDX_PUSH_TAGS = "-t docker.io/nginxproxymanager/${IMAGE}:${BASE_TAG}"
33-
env.BUILDX_PUSH_TAGS_NODE = "-t docker.io/nginxproxymanager/${IMAGE}:node"
31+
env.BASE_TAG = 'latest'
32+
env.BUILDX_PUSH_TAGS = "-t docker.io/nginxproxymanager/${IMAGE}:${BASE_TAG}"
33+
env.BUILDX_PUSH_TAGS_ACMESH = "-t docker.io/nginxproxymanager/${IMAGE}:acmesh"
34+
env.BUILDX_PUSH_TAGS_CERTBOT = "-t docker.io/nginxproxymanager/${IMAGE}:certbot"
35+
env.BUILDX_PUSH_TAGS_ACMESH_GOLANG = "-t docker.io/nginxproxymanager/${IMAGE}:acmesh-golang"
36+
env.BUILDX_PUSH_TAGS_CERTBOT_NODE = "-t docker.io/nginxproxymanager/${IMAGE}:certbot-node"
3437
}
3538
}
3639
}
@@ -43,15 +46,20 @@ pipeline {
4346
steps {
4447
script {
4548
// Defaults to the Branch name, which is applies to all branches AND pr's
46-
env.BASE_TAG = "github-${BRANCH_LOWER}"
47-
env.BUILDX_PUSH_TAGS = "-t docker.io/nginxproxymanager/${IMAGE}:${BASE_TAG}"
48-
env.BUILDX_PUSH_TAGS_NODE = "${BUILDX_PUSH_TAGS}-node"
49+
env.BASE_TAG = "github-${BRANCH_LOWER}"
50+
env.ACMESH_BASE_TAG = "github-${BRANCH_LOWER}-acmesh"
51+
env.CERTBOT_BASE_TAG = "github-${BRANCH_LOWER}-certbot"
52+
env.BUILDX_PUSH_TAGS = "-t docker.io/nginxproxymanager/${IMAGE}:${BASE_TAG}"
53+
env.BUILDX_PUSH_TAGS_ACMESH = "${BUILDX_PUSH_TAGS}-acmesh"
54+
env.BUILDX_PUSH_TAGS_CERTBOT = "${BUILDX_PUSH_TAGS}-certbot"
55+
env.BUILDX_PUSH_TAGS_ACMESH_GOLANG = "${BUILDX_PUSH_TAGS}-acmesh-golang"
56+
env.BUILDX_PUSH_TAGS_CERTBOT_NODE = "${BUILDX_PUSH_TAGS}-certbot-node"
4957
}
5058
}
5159
}
5260
}
5361
}
54-
stage('Base Build') {
62+
stage('Base') {
5563
environment {
5664
BUILDX_NAME = "${IMAGE}_${GIT_BRANCH}_base"
5765
}
@@ -62,18 +70,27 @@ pipeline {
6270
}
6371
}
6472
}
65-
stage('Other Builds') {
66-
parallel {
67-
stage('Node') {
68-
environment {
69-
BUILDX_NAME = "${IMAGE}_${GIT_BRANCH}_node"
70-
}
71-
steps {
72-
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'DOCKER_PASS', usernameVariable: 'DOCKER_USER')]) {
73-
sh 'docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"'
74-
sh "./scripts/buildx --push -f docker/Dockerfile.node ${BUILDX_PUSH_TAGS_NODE}"
75-
}
76-
}
73+
stage('Acme Clients') {
74+
environment {
75+
BUILDX_NAME = "${IMAGE}_${GIT_BRANCH}_node"
76+
}
77+
steps {
78+
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'DOCKER_PASS', usernameVariable: 'DOCKER_USER')]) {
79+
sh 'docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"'
80+
sh "./scripts/buildx --push -f docker/Dockerfile.acmesh ${BUILDX_PUSH_TAGS_ACMESH}"
81+
sh "./scripts/buildx --push -f docker/Dockerfile.certbot ${BUILDX_PUSH_TAGS_CERTBOT}"
82+
}
83+
}
84+
}
85+
stage('Dev Tools') {
86+
environment {
87+
BUILDX_NAME = "${IMAGE}_${GIT_BRANCH}_node"
88+
}
89+
steps {
90+
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'DOCKER_PASS', usernameVariable: 'DOCKER_USER')]) {
91+
sh 'docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"'
92+
sh "./scripts/buildx --push -f docker/Dockerfile.acmesh-golang ${BUILDX_PUSH_TAGS_ACMESH_GOLANG}"
93+
sh "./scripts/buildx --push -f docker/Dockerfile.certbot-node ${BUILDX_PUSH_TAGS_CERTBOT_NODE}"
7794
}
7895
}
7996
}

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@
1717

1818
This is a base image for use in other images. See Dockerfile for build steps.
1919

20-
The following is compiled/installed:
20+
The following images are built:
2121

22+
**latest**
2223
- OpenResty
2324
- Lua
25+
26+
**certbot**
27+
- Certbot
28+
- Python3 and pip
29+
30+
**acmesh** _(used in Nginx Proxy Manager v3)_
31+
- Acme.sh
32+
33+
**certbot-node** _(used in Nginx Proxy Manager v2)_
2434
- Certbot
2535
- Python3 and pip
36+
- Nodejs
37+
38+
**acmesh-golang** _(development for Nginx Proxy Manager v3)_
39+
- Acme.sh
40+
- Golang
2641

27-
The following architectures are supported:
42+
The following architectures are supported for all images:
2843

2944
- amd64
3045
- arm/v7
@@ -33,7 +48,7 @@ The following architectures are supported:
3348
### Usage:
3449

3550
```
36-
FROM nginxproxymanager/nginx-full
51+
FROM nginxproxymanager/nginx-full:latest
3752
3853
...
3954
```

docker/Dockerfile

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,3 @@
1-
#############
2-
# Certbot Builder
3-
#############
4-
5-
FROM debian:buster-slim as certbotbuilder
6-
7-
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
8-
9-
RUN apt-get update
10-
RUN apt-get install -y \
11-
build-essential \
12-
curl \
13-
libaugeas0 \
14-
python3 \
15-
python3-dev \
16-
libffi-dev \
17-
libssl-dev \
18-
python3-venv \
19-
ca-certificates
20-
21-
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
22-
23-
# Yes, python compilation requires rust.
24-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
25-
ENV PATH="/root/.cargo/bin:$PATH"
26-
27-
# It's all about pip now.
28-
RUN python3 -m venv /opt/certbot/
29-
ENV PATH="/opt/certbot/bin:$PATH"
30-
31-
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3
32-
33-
# Handle an extremely specific issue when building the cryptography package for
34-
# 32-bit architectures within QEMU running on a 64-bit host
35-
# Special thanks to https://github.com/JonasAlfredsson/docker-nginx-certbot
36-
RUN if [ "$(getconf LONG_BIT)" = "32" ]; then \
37-
pip3 install --no-cache-dir -U cryptography==3.3.2; \
38-
fi
39-
40-
RUN pip install --no-cache-dir cffi certbot \
41-
&& pip install tldextract
42-
431
#############
442
# Nginx Builder
453
#############
@@ -83,26 +41,25 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
8341
ARG TARGETPLATFORM
8442
RUN echo "Base: debian:buster-slim, ${TARGETPLATFORM:-linux/amd64}" > /built-for-arch
8543

86-
# OpenResty uses LuaJIT which has a dependency on GCC
44+
# OpenResty uses LuaJIT which has a dependency on GCC
8745
RUN apt-get update \
8846
&& apt-get install -y --no-install-recommends \
8947
apache2-utils \
9048
ca-certificates \
9149
curl \
9250
figlet \
51+
jq \
9352
libncurses6 \
9453
libpcre3 \
9554
libreadline7 \
9655
openssl \
9756
perl \
98-
python3 \
99-
python3-distutils \
100-
python3-venv \
10157
tzdata \
10258
unzip \
10359
zlib1g \
10460
&& apt-get clean \
105-
&& rm -rf /var/lib/apt/lists/*
61+
&& rm -rf /var/lib/apt/lists/* \
62+
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
10663

10764
COPY ./files/.bashrc /root/.bashrc
10865

@@ -115,44 +72,25 @@ COPY ./scripts/install-lua /tmp/install-lua
11572
COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
11673
COPY ./scripts/install-openresty /tmp/install-openresty
11774

118-
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
119-
120-
# Copy certbot
121-
COPY --from=certbotbuilder /opt/certbot /opt/certbot
122-
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3 \
123-
&& python3 -m venv /opt/certbot/ \
124-
&& ln -s /opt/certbot/bin/certbot /usr/bin/certbot
125-
12675
ARG OPENRESTY_VERSION
127-
ENV OPENRESTY_VERSION=${OPENRESTY_VERSION} \
128-
CERT_HOME='/data/acme.sh/' \
129-
PATH="/opt/certbot/bin:$PATH"
76+
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
77+
OPENRESTY_VERSION=${OPENRESTY_VERSION}
13078

131-
# Install openresty, lua
79+
# Install openresty, lua, then clean up file system
13280
RUN apt-get update \
133-
&& apt-get install -y \
134-
gcc \
135-
make \
136-
socat \
137-
git \
81+
&& apt-get install -y gcc make socat git \
13882
&& /tmp/install-lua \
13983
&& /tmp/install-openresty \
140-
&& rm -f /tmp/install-lua \
141-
&& rm -f /tmp/install-openresty \
14284
&& apt-get remove -y make gcc git \
14385
&& apt-get autoremove -y \
14486
&& apt-get clean \
145-
&& rm -rf /var/lib/apt/lists/*
146-
147-
# acme.sh
148-
RUN mkdir -p /data/acme.sh \
149-
&& curl -o /bin/acme.sh 'https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh' \
150-
&& chmod +x /bin/acme.sh
87+
&& rm -rf /var/lib/apt/lists/* \
88+
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
15189

15290
LABEL org.label-schema.schema-version="1.0" \
15391
org.label-schema.license="MIT" \
15492
org.label-schema.name="nginx-full" \
15593
org.label-schema.description="A base image for use by Nginx Proxy Manager" \
156-
org.label-schema.url="https://github.com/jc21/docker-nginx-full" \
157-
org.label-schema.vcs-url="https://github.com/jc21/docker-nginx-full.git" \
158-
org.label-schema.cmd="docker run --rm -ti jc21/nginx-full:latest"
94+
org.label-schema.url="https://github.com/nginxproxymanager/docker-nginx-full" \
95+
org.label-schema.vcs-url="https://github.com/nginxproxymanager/docker-nginx-full.git" \
96+
org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:latest"

docker/Dockerfile.acmesh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM nginxproxymanager/nginx-full:${BASE_TAG:-latest}
2+
LABEL maintainer="Jamie Curnow <[email protected]>"
3+
4+
ARG TARGETPLATFORM
5+
RUN echo "Acme.sh: nginxproxymanager/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
6+
7+
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
8+
9+
# acme.sh
10+
RUN mkdir -p /data/acme.sh \
11+
&& curl -o /bin/acme.sh 'https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh' \
12+
&& chmod +x /bin/acme.sh
13+
14+
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:acmesh"

docker/Dockerfile.acmesh-golang

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:latest as go
2+
FROM nginxproxymanager/nginx-full:${ACMESH_BASE_TAG:-acmesh}
3+
LABEL maintainer="Jamie Curnow <[email protected]>"
4+
5+
ARG TARGETPLATFORM
6+
RUN echo "Golang: nginxproxymanager/nginx-full:${BASE_TAG:-acmesh}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
7+
8+
RUN apt-get update \
9+
&& apt-get install -y wget gcc g++ make git sqlite3 jq \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# copy go from golang
14+
COPY --from=go /usr/local/go /usr/local/go
15+
16+
ENV GOPATH=/opt/go PATH="/usr/local/go/bin:$PATH:/opt/go/bin"
17+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
18+
&& chmod -R 777 "$GOPATH" \
19+
&& echo "====> ${TARGETPLATFORM}: $(go version)"
20+
21+
WORKDIR /root
22+
23+
# Gotools
24+
RUN if [ "$TARGETPLATFORM" == "" ] || [ "$TARGETPLATFORM" == "linux/amd64" ]; then cd /usr && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.39.0; fi
25+
RUN go get -u github.com/kyoh86/richgo \
26+
&& go get -u github.com/sonatype-nexus-community/nancy \
27+
&& rm -rf /root/.cache/go-build
28+
29+
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:acmesh-golang"

docker/Dockerfile.certbot

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#############
2+
# Certbot Builder
3+
#############
4+
5+
FROM debian:buster-slim as certbotbuilder
6+
7+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
8+
9+
RUN apt-get update
10+
RUN apt-get install -y \
11+
build-essential \
12+
curl \
13+
libaugeas0 \
14+
python3 \
15+
python3-dev \
16+
libffi-dev \
17+
libssl-dev \
18+
python3-venv \
19+
ca-certificates
20+
21+
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
22+
23+
# Yes, python compilation requires rust.
24+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
25+
ENV PATH="/root/.cargo/bin:$PATH"
26+
27+
# It's all about pip now.
28+
RUN python3 -m venv /opt/certbot/
29+
ENV PATH="/opt/certbot/bin:$PATH"
30+
31+
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3
32+
33+
# Handle an extremely specific issue when building the cryptography package for
34+
# 32-bit architectures within QEMU running on a 64-bit host
35+
# Special thanks to https://github.com/JonasAlfredsson/docker-nginx-certbot
36+
RUN if [ "$(getconf LONG_BIT)" = "32" ]; then \
37+
pip3 install --no-cache-dir -U cryptography==3.3.2; \
38+
fi
39+
40+
RUN pip install --no-cache-dir cffi certbot \
41+
&& pip install tldextract
42+
43+
#############
44+
# Final Image
45+
#############
46+
47+
FROM nginxproxymanager/nginx-full:${BASE_TAG:-latest}
48+
LABEL maintainer="Jamie Curnow <[email protected]>"
49+
50+
ARG TARGETPLATFORM
51+
RUN echo "Certbot: nginxproxymanager/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
52+
53+
# OpenResty uses LuaJIT which has a dependency on GCC
54+
RUN apt-get update \
55+
&& apt-get install -y --no-install-recommends \
56+
python3 \
57+
python3-distutils \
58+
python3-venv \
59+
&& apt-get clean \
60+
&& rm -rf /var/lib/apt/lists/*
61+
62+
# Copy certbot
63+
COPY --from=certbotbuilder /opt/certbot /opt/certbot
64+
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3 \
65+
&& python3 -m venv /opt/certbot/ \
66+
&& ln -s /opt/certbot/bin/certbot /usr/bin/certbot
67+
68+
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:certbot"

docker/Dockerfile.node renamed to docker/Dockerfile.certbot-node

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM nginxproxymanager/nginx-full:${BASE_TAG:-latest}
1+
FROM nginxproxymanager/nginx-full:${CERTBOT_BASE_TAG:-certbot}
22
LABEL maintainer="Jamie Curnow <[email protected]>"
33

44
ARG TARGETPLATFORM
5-
RUN echo "Node: jc21/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
5+
RUN echo "Node: nginxproxymanager/nginx-full:${BASE_TAG:-certbot}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
66

77
ENV CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
88

@@ -17,3 +17,5 @@ RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
1717
COPY ./files/test.js /tmp/test.js
1818
RUN node /tmp/test.js \
1919
&& rm -f /tmp/test.js
20+
21+
LABEL org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:certbot-node"

0 commit comments

Comments
 (0)