mirror of
https://github.com/nginx-proxy/nginx-proxy
synced 2024-04-27 12:25:25 +02:00
build: replace forego with goreman
This commit is contained in:
parent
53ef90a2f6
commit
eb4ed6d8e6
26
Dockerfile
26
Dockerfile
|
@ -1,6 +1,6 @@
|
|||
# setup build arguments for version of dependencies to use
|
||||
ARG DOCKER_GEN_VERSION=0.7.7
|
||||
ARG FOREGO_VERSION=v0.17.0
|
||||
ARG GOREMAN_VERSION=v0.3.8
|
||||
|
||||
# Use a specific version of golang to build both binaries
|
||||
FROM golang:1.16.7 as gobuilder
|
||||
|
@ -20,20 +20,20 @@ RUN git clone https://github.com/jwilder/docker-gen \
|
|||
&& cd - \
|
||||
&& rm -rf /go/docker-gen
|
||||
|
||||
# Build forego from scratch
|
||||
FROM gobuilder as forego
|
||||
# Build goreman from scratch
|
||||
FROM gobuilder as goreman
|
||||
|
||||
ARG FOREGO_VERSION
|
||||
ARG GOREMAN_VERSION
|
||||
|
||||
RUN git clone https://github.com/nginx-proxy/forego/ \
|
||||
&& cd /go/forego \
|
||||
&& git -c advice.detachedHead=false checkout $FOREGO_VERSION \
|
||||
RUN git clone https://github.com/mattn/goreman/ \
|
||||
&& cd /go/goreman \
|
||||
&& git -c advice.detachedHead=false checkout $GOREMAN_VERSION \
|
||||
&& go mod download \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -o forego . \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -o goreman . \
|
||||
&& go clean -cache \
|
||||
&& mv forego /usr/local/bin/ \
|
||||
&& mv goreman /usr/local/bin/ \
|
||||
&& cd - \
|
||||
&& rm -rf /go/forego
|
||||
&& rm -rf /go/goreman
|
||||
|
||||
# Build the final image
|
||||
FROM nginx:1.21.5
|
||||
|
@ -54,8 +54,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
|||
&& sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \
|
||||
&& mkdir -p '/etc/nginx/dhparam'
|
||||
|
||||
# Install Forego + docker-gen
|
||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||
# Install goreman + docker-gen
|
||||
COPY --from=goreman /usr/local/bin/goreman /usr/local/bin/goreman
|
||||
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
||||
|
||||
# Add DOCKER_GEN_VERSION environment variable
|
||||
|
@ -71,4 +71,4 @@ WORKDIR /app/
|
|||
ENV DOCKER_HOST unix:///tmp/docker.sock
|
||||
|
||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||
CMD ["forego", "start", "-r"]
|
||||
CMD ["goreman", "start"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# setup build arguments for version of dependencies to use
|
||||
ARG DOCKER_GEN_VERSION=0.7.7
|
||||
ARG FOREGO_VERSION=v0.17.0
|
||||
ARG GOREMAN_VERSION=v0.3.8
|
||||
|
||||
# Use a specific version of golang to build both binaries
|
||||
FROM golang:1.16.7-alpine as gobuilder
|
||||
|
@ -21,20 +21,20 @@ RUN git clone https://github.com/jwilder/docker-gen \
|
|||
&& cd - \
|
||||
&& rm -rf /go/docker-gen
|
||||
|
||||
# Build forego from scratch
|
||||
FROM gobuilder as forego
|
||||
# Build goreman from scratch
|
||||
FROM gobuilder as goreman
|
||||
|
||||
ARG FOREGO_VERSION
|
||||
ARG GOREMAN_VERSION
|
||||
|
||||
RUN git clone https://github.com/nginx-proxy/forego/ \
|
||||
&& cd /go/forego \
|
||||
&& git -c advice.detachedHead=false checkout $FOREGO_VERSION \
|
||||
RUN git clone https://github.com/mattn/goreman/ \
|
||||
&& cd /go/goreman \
|
||||
&& git -c advice.detachedHead=false checkout $GOREMAN_VERSION \
|
||||
&& go mod download \
|
||||
&& CGO_ENABLED=0 go build -o forego . \
|
||||
&& CGO_ENABLED=0 go build -o goreman . \
|
||||
&& go clean -cache \
|
||||
&& mv forego /usr/local/bin/ \
|
||||
&& mv goreman /usr/local/bin/ \
|
||||
&& cd - \
|
||||
&& rm -rf /go/forego
|
||||
&& rm -rf /go/goreman
|
||||
|
||||
# Build the final image
|
||||
FROM nginx:1.21.5-alpine
|
||||
|
@ -51,8 +51,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
|||
&& sed -i 's/worker_connections 1024/worker_connections 10240/' /etc/nginx/nginx.conf \
|
||||
&& mkdir -p '/etc/nginx/dhparam'
|
||||
|
||||
# Install Forego + docker-gen
|
||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||
# Install goreman + docker-gen
|
||||
COPY --from=goreman /usr/local/bin/goreman /usr/local/bin/goreman
|
||||
COPY --from=dockergen /usr/local/bin/docker-gen /usr/local/bin/docker-gen
|
||||
|
||||
# Add DOCKER_GEN_VERSION environment variable
|
||||
|
@ -68,4 +68,4 @@ WORKDIR /app/
|
|||
ENV DOCKER_HOST unix:///tmp/docker.sock
|
||||
|
||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||
CMD ["forego", "start", "-r"]
|
||||
CMD ["goreman", "start"]
|
||||
|
|
|
@ -95,7 +95,7 @@ function _setup_dhparam() {
|
|||
}
|
||||
|
||||
# Run the init logic if the default CMD was provided
|
||||
if [[ $* == 'forego start -r' ]]; then
|
||||
if [[ $* == 'goreman start' ]]; then
|
||||
_check_unix_socket
|
||||
|
||||
_resolvers
|
||||
|
|
|
@ -25,26 +25,26 @@ Log shows:
|
|||
```
|
||||
webB_1 | starting a web server listening on port 82
|
||||
webA_1 | starting a web server listening on port 81
|
||||
reverseproxy | forego | starting dockergen.1 on port 5000
|
||||
reverseproxy | forego | starting nginx.1 on port 5100
|
||||
reverseproxy | goreman | starting dockergen.1 on port 5000
|
||||
reverseproxy | goreman | starting nginx.1 on port 5100
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Generated '/etc/nginx/conf.d/default.conf' from 3 containers
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Running 'nginx -s reload'
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Error running notify command: nginx -s reload, exit status 1
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Watching docker events
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
|
||||
reverseproxy | reverseproxy | forego | starting dockergen.1 on port 5000 <---- nginx-proxy container restarted
|
||||
reverseproxy | forego | starting nginx.1 on port 5100
|
||||
reverseproxy | reverseproxy | goreman | starting dockergen.1 on port 5000 <---- nginx-proxy container restarted
|
||||
reverseproxy | goreman | starting nginx.1 on port 5100
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Generated '/etc/nginx/conf.d/default.conf' from 3 containers
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Running 'nginx -s reload'
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Error running notify command: nginx -s reload, exit status 1
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Watching docker events
|
||||
reverseproxy | dockergen.1 | 2017/02/20 01:10:24 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
|
||||
reverseproxy | forego | starting dockergen.1 on port 5000
|
||||
reverseproxy | forego | starting nginx.1 on port 5100
|
||||
reverseproxy | nginx.1 | 2017/02/20 01:11:02 [emerg] 17#17: no servers are inside upstream in /etc/nginx/conf.d/default.conf:64
|
||||
reverseproxy | forego | starting nginx.1 on port 5200
|
||||
reverseproxy | forego | sending SIGTERM to nginx.1
|
||||
reverseproxy | forego | sending SIGTERM to dockergen.1
|
||||
reverseproxy | goreman | starting dockergen.1 on port 5000
|
||||
reverseproxy | goreman | starting nginx.1 on port 5100
|
||||
reverseproxy | nginx.1 | 2017/02/20 01:11:02 [emerg] 17#17: no servers are inside upstream in /etc/nginx/conf.d/default.conf:64
|
||||
reverseproxy | goreman | starting nginx.1 on port 5200
|
||||
reverseproxy | goreman | sending SIGTERM to nginx.1
|
||||
reverseproxy | goreman | sending SIGTERM to dockergen.1
|
||||
reverseproxy exited with code 0
|
||||
reverseproxy exited with code 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue