| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | # setup build arguments for version of dependencies to useARG DOCKER_GEN_VERSION=0.7.6ARG FOREGO_VERSION=0.16.1# Use a specific version of golang to build both binariesFROM golang:1.15.10 as gobuilder# Build docker-gen from scratchFROM gobuilder as dockergenARG DOCKER_GEN_VERSIONRUN git clone https://github.com/jwilder/docker-gen \   && cd /go/docker-gen \   && git -c advice.detachedHead=false checkout $DOCKER_GEN_VERSION \   && go mod download \   && CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.buildVersion=${DOCKER_GEN_VERSION}" ./cmd/docker-gen \   && go clean -cache \   && mv docker-gen /usr/local/bin/ \   && cd - \   && rm -rf /go/docker-gen# Build forego from scratch# Because this relies on golang workspaces, we need to use go < 1.8. FROM gobuilder as forego# Download the sources for the given versionARG FOREGO_VERSIONADD https://github.com/jwilder/forego/archive/v${FOREGO_VERSION}.tar.gz sources.tar.gz# Move the sources into the right directoryRUN tar -xzf sources.tar.gz && \   mkdir -p /go/src/github.com/ddollar/ && \   mv forego-* /go/src/github.com/ddollar/forego# Install the dependencies and make the forego executableWORKDIR /go/src/github.com/ddollar/forego/RUN go get -v ./... && \   CGO_ENABLED=0 GOOS=linux go build -o forego .# Build the final imageFROM nginx:1.19.10LABEL maintainer="Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag)"# Install wget and install/updates certificatesRUN apt-get update \ && apt-get install -y -q --no-install-recommends \    ca-certificates \    wget \ && apt-get clean \ && rm -r /var/lib/apt/lists/*# Configure Nginx and apply fix for very long server namesRUN echo "daemon off;" >> /etc/nginx/nginx.conf \ && sed -i 's/worker_processes  1/worker_processes  auto/' /etc/nginx/nginx.conf \ && sed -i 's/worker_connections  1024/worker_connections  10240/' /etc/nginx/nginx.conf# Install Forego + docker-genCOPY --from=forego /go/src/github.com/ddollar/forego/forego /usr/local/bin/foregoCOPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen# Add DOCKER_GEN_VERSION environment variable# Because some external projects rely on itARG DOCKER_GEN_VERSIONENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION}COPY network_internal.conf /etc/nginx/COPY . /app/WORKDIR /app/ENV DOCKER_HOST unix:///tmp/docker.sockVOLUME ["/etc/nginx/certs", "/etc/nginx/dhparam"]ENTRYPOINT ["/app/docker-entrypoint.sh"]CMD ["forego", "start", "-r"]
 |