mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
feat: display container version
This commit is contained in:
parent
fde0e809e4
commit
fbf37456d0
15
Dockerfile
15
Dockerfile
@ -39,6 +39,14 @@ RUN git clone https://github.com/nginx-proxy/forego/ \
|
|||||||
FROM nginx:1.21.5
|
FROM nginx:1.21.5
|
||||||
LABEL maintainer="Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag)"
|
LABEL maintainer="Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag)"
|
||||||
|
|
||||||
|
ARG NGINX_PROXY_VERSION
|
||||||
|
# Add DOCKER_GEN_VERSION environment variable
|
||||||
|
# Because some external projects rely on it
|
||||||
|
ARG DOCKER_GEN_VERSION
|
||||||
|
ENV NGINX_PROXY_VERSION=${NGINX_PROXY_VERSION} \
|
||||||
|
DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \
|
||||||
|
DOCKER_HOST=unix:///tmp/docker.sock
|
||||||
|
|
||||||
# Install wget and install/updates certificates
|
# Install wget and install/updates certificates
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y -q --no-install-recommends \
|
&& apt-get install -y -q --no-install-recommends \
|
||||||
@ -58,17 +66,10 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
|||||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||||
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
||||||
|
|
||||||
# Add DOCKER_GEN_VERSION environment variable
|
|
||||||
# Because some external projects rely on it
|
|
||||||
ARG DOCKER_GEN_VERSION
|
|
||||||
ENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION}
|
|
||||||
|
|
||||||
COPY network_internal.conf /etc/nginx/
|
COPY network_internal.conf /etc/nginx/
|
||||||
|
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
|
||||||
ENV DOCKER_HOST unix:///tmp/docker.sock
|
|
||||||
|
|
||||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
CMD ["forego", "start", "-r"]
|
CMD ["forego", "start", "-r"]
|
||||||
|
@ -40,6 +40,14 @@ RUN git clone https://github.com/nginx-proxy/forego/ \
|
|||||||
FROM nginx:1.21.5-alpine
|
FROM nginx:1.21.5-alpine
|
||||||
LABEL maintainer="Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag)"
|
LABEL maintainer="Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag)"
|
||||||
|
|
||||||
|
ARG NGINX_PROXY_VERSION
|
||||||
|
# Add DOCKER_GEN_VERSION environment variable
|
||||||
|
# Because some external projects rely on it
|
||||||
|
ARG DOCKER_GEN_VERSION
|
||||||
|
ENV NGINX_PROXY_VERSION=${NGINX_PROXY_VERSION} \
|
||||||
|
DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \
|
||||||
|
DOCKER_HOST=unix:///tmp/docker.sock
|
||||||
|
|
||||||
# Install wget and install/updates certificates
|
# Install wget and install/updates certificates
|
||||||
RUN apk add --no-cache --virtual .run-deps \
|
RUN apk add --no-cache --virtual .run-deps \
|
||||||
ca-certificates bash wget openssl \
|
ca-certificates bash wget openssl \
|
||||||
@ -55,17 +63,10 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
|||||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||||
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
||||||
|
|
||||||
# Add DOCKER_GEN_VERSION environment variable
|
|
||||||
# Because some external projects rely on it
|
|
||||||
ARG DOCKER_GEN_VERSION
|
|
||||||
ENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION}
|
|
||||||
|
|
||||||
COPY network_internal.conf /etc/nginx/
|
COPY network_internal.conf /etc/nginx/
|
||||||
|
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
|
||||||
ENV DOCKER_HOST unix:///tmp/docker.sock
|
|
||||||
|
|
||||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
CMD ["forego", "start", "-r"]
|
CMD ["forego", "start", "-r"]
|
||||||
|
@ -29,6 +29,12 @@ function _parse_false() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _print_version {
|
||||||
|
if [[ -n "${NGINX_PROXY_VERSION:-}" ]]; then
|
||||||
|
echo "Info: running nginx-proxy version ${NGINX_PROXY_VERSION}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function _check_unix_socket() {
|
function _check_unix_socket() {
|
||||||
# Warn if the DOCKER_HOST socket does not exist
|
# Warn if the DOCKER_HOST socket does not exist
|
||||||
if [[ ${DOCKER_HOST} == unix://* ]]; then
|
if [[ ${DOCKER_HOST} == unix://* ]]; then
|
||||||
@ -96,6 +102,8 @@ function _setup_dhparam() {
|
|||||||
|
|
||||||
# Run the init logic if the default CMD was provided
|
# Run the init logic if the default CMD was provided
|
||||||
if [[ $* == 'forego start -r' ]]; then
|
if [[ $* == 'forego start -r' ]]; then
|
||||||
|
_print_version
|
||||||
|
|
||||||
_check_unix_socket
|
_check_unix_socket
|
||||||
|
|
||||||
_resolvers
|
_resolvers
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
|
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
|
||||||
|
|
||||||
|
{{ $nginx_proxy_version := coalesce $.Env.NGINX_PROXY_VERSION "" }}
|
||||||
{{ $external_http_port := coalesce $.Env.HTTP_PORT "80" }}
|
{{ $external_http_port := coalesce $.Env.HTTP_PORT "80" }}
|
||||||
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
||||||
{{ $debug_all := $.Env.DEBUG }}
|
{{ $debug_all := $.Env.DEBUG }}
|
||||||
@ -48,6 +49,10 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if ne $nginx_proxy_version "" }}
|
||||||
|
# nginx-proxy version : {{ $nginx_proxy_version }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
|
||||||
# scheme used to connect to this server
|
# scheme used to connect to this server
|
||||||
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user