Restructured docker images heirarchy

This commit is contained in:
Jamie Curnow
2022-01-10 22:10:42 +10:00
parent 30e4dce672
commit 44a795cf5f
9 changed files with 239 additions and 99 deletions
+13 -75
View File
@@ -1,45 +1,3 @@
#############
# Certbot Builder
#############
FROM debian:buster-slim as certbotbuilder
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update
RUN apt-get install -y \
build-essential \
curl \
libaugeas0 \
python3 \
python3-dev \
libffi-dev \
libssl-dev \
python3-venv \
ca-certificates
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
# Yes, python compilation requires rust.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"
# It's all about pip now.
RUN python3 -m venv /opt/certbot/
ENV PATH="/opt/certbot/bin:$PATH"
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3
# Handle an extremely specific issue when building the cryptography package for
# 32-bit architectures within QEMU running on a 64-bit host
# Special thanks to https://github.com/JonasAlfredsson/docker-nginx-certbot
RUN if [ "$(getconf LONG_BIT)" = "32" ]; then \
pip3 install --no-cache-dir -U cryptography==3.3.2; \
fi
RUN pip install --no-cache-dir cffi certbot \
&& pip install tldextract
#############
# Nginx Builder
#############
@@ -83,26 +41,25 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG TARGETPLATFORM
RUN echo "Base: debian:buster-slim, ${TARGETPLATFORM:-linux/amd64}" > /built-for-arch
# OpenResty uses LuaJIT which has a dependency on GCC
# OpenResty uses LuaJIT which has a dependency on GCC
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apache2-utils \
ca-certificates \
curl \
figlet \
jq \
libncurses6 \
libpcre3 \
libreadline7 \
openssl \
perl \
python3 \
python3-distutils \
python3-venv \
tzdata \
unzip \
zlib1g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
COPY ./files/.bashrc /root/.bashrc
@@ -115,44 +72,25 @@ COPY ./scripts/install-lua /tmp/install-lua
COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
COPY ./scripts/install-openresty /tmp/install-openresty
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
# Copy certbot
COPY --from=certbotbuilder /opt/certbot /opt/certbot
RUN curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3 \
&& python3 -m venv /opt/certbot/ \
&& ln -s /opt/certbot/bin/certbot /usr/bin/certbot
ARG OPENRESTY_VERSION
ENV OPENRESTY_VERSION=${OPENRESTY_VERSION} \
CERT_HOME='/data/acme.sh/' \
PATH="/opt/certbot/bin:$PATH"
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
OPENRESTY_VERSION=${OPENRESTY_VERSION}
# Install openresty, lua
# Install openresty, lua, then clean up file system
RUN apt-get update \
&& apt-get install -y \
gcc \
make \
socat \
git \
&& apt-get install -y gcc make socat git \
&& /tmp/install-lua \
&& /tmp/install-openresty \
&& rm -f /tmp/install-lua \
&& rm -f /tmp/install-openresty \
&& apt-get remove -y make gcc git \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# acme.sh
RUN mkdir -p /data/acme.sh \
&& curl -o /bin/acme.sh 'https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh' \
&& chmod +x /bin/acme.sh
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/* /var/log/* /tmp/* /var/lib/dpkg/status-old
LABEL org.label-schema.schema-version="1.0" \
org.label-schema.license="MIT" \
org.label-schema.name="nginx-full" \
org.label-schema.description="A base image for use by Nginx Proxy Manager" \
org.label-schema.url="https://github.com/jc21/docker-nginx-full" \
org.label-schema.vcs-url="https://github.com/jc21/docker-nginx-full.git" \
org.label-schema.cmd="docker run --rm -ti jc21/nginx-full:latest"
org.label-schema.url="https://github.com/nginxproxymanager/docker-nginx-full" \
org.label-schema.vcs-url="https://github.com/nginxproxymanager/docker-nginx-full.git" \
org.label-schema.cmd="docker run --rm -ti nginxproxymanager/nginx-full:latest"