github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/containers/ddev-router/Dockerfile (about) 1 FROM nginx:1.20.1 2 3 ENV MKCERT_VERSION=v1.4.6 4 5 ENV DEBIAN_FRONTEND noninteractive 6 ENV DOCKER_GEN_VERSION 0.7.7 7 ENV DOCKER_HOST unix:///tmp/docker.sock 8 9 ARG TARGETARCH 10 11 SHELL ["/bin/bash", "-c"] 12 13 # Get forego, which may be either a binary download (jwilder) or 14 # a tarball (from https://github.com/ddollar/forego download) 15 RUN set -eu -o pipefail && \ 16 FOREGO_URL="https://github.com/drud/forego/releases/download/v0.16.1/forego-${TARGETARCH}" && \ 17 cd /tmp && curl --fail -sSL -o /usr/local/bin/forego "${FOREGO_URL}" && chmod +x /usr/local/bin/forego 18 19 RUN apt-get -qq update && \ 20 apt-get -qq install --no-install-recommends --no-install-suggests -y \ 21 ca-certificates certbot curl iputils-ping less python3-certbot-nginx procps telnet vim wget && \ 22 apt-get autoremove -y && \ 23 apt-get clean -y && \ 24 rm -rf /var/lib/apt/lists/* 25 26 # Download docker-gen 27 RUN set -eu -o pipefail && \ 28 export DOCKER_GEN_FILE="docker-gen-linux-${TARGETARCH}-${DOCKER_GEN_VERSION}.tar.gz" && \ 29 cd /tmp && wget -q https://github.com/drud/docker-gen/releases/download/${DOCKER_GEN_VERSION}/${DOCKER_GEN_FILE} && \ 30 tar -C /usr/local/bin -xzf "${DOCKER_GEN_FILE}" && \ 31 rm $DOCKER_GEN_FILE 32 33 RUN mkdir -p /etc/nginx/certs /mnt/ddev-global-cache/mkcert 34 35 # curl mkcert and install it 36 RUN set -eu -o pipefail && \ 37 curl --fail -JL -s -o /usr/local/bin/mkcert "https://dl.filippo.io/mkcert/latest?for=linux/${TARGETARCH}" && chmod +x /usr/local/bin/mkcert && \ 38 mkdir -p /root/.local/share && \ 39 ln -s /mnt/ddev-global-cache/mkcert /root/.local/share/mkcert && \ 40 mkcert -install 41 42 43 # Configure Nginx and apply fix for very long server names 44 RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ 45 && sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf 46 47 # We don't want the default.conf provided by nginx package 48 RUN rm -f /etc/nginx/conf.d/default.conf 49 50 ADD . /app/ 51 ADD etc /etc 52 RUN chmod ugo+x /app/healthcheck.sh 53 54 ENTRYPOINT ["/app/docker-entrypoint.sh"] 55 CMD ["forego", "start", "-r"] 56 WORKDIR /app/ 57 58 HEALTHCHECK --interval=1s --retries=10 --timeout=120s --start-period=10s CMD /app/healthcheck.sh