mirror of
https://github.com/thib8956/nginx-proxy
synced 2025-02-24 01:38:15 +00:00
chore: switch to go mod compatible fork of forego
This commit is contained in:
parent
fe79dd4cd3
commit
242caf9e69
25
Dockerfile
25
Dockerfile
@ -1,6 +1,6 @@
|
|||||||
# setup build arguments for version of dependencies to use
|
# setup build arguments for version of dependencies to use
|
||||||
ARG DOCKER_GEN_VERSION=0.7.6
|
ARG DOCKER_GEN_VERSION=0.7.6
|
||||||
ARG FOREGO_VERSION=0.16.1
|
ARG FOREGO_VERSION=v0.17.0
|
||||||
|
|
||||||
# Use a specific version of golang to build both binaries
|
# Use a specific version of golang to build both binaries
|
||||||
FROM golang:1.15.10 as gobuilder
|
FROM golang:1.15.10 as gobuilder
|
||||||
@ -21,22 +21,19 @@ RUN git clone https://github.com/jwilder/docker-gen \
|
|||||||
&& rm -rf /go/docker-gen
|
&& rm -rf /go/docker-gen
|
||||||
|
|
||||||
# Build forego from scratch
|
# Build forego from scratch
|
||||||
# Because this relies on golang workspaces, we need to use go < 1.8.
|
|
||||||
FROM gobuilder as forego
|
FROM gobuilder as forego
|
||||||
|
|
||||||
# Download the sources for the given version
|
|
||||||
ARG FOREGO_VERSION
|
ARG FOREGO_VERSION
|
||||||
ADD https://github.com/jwilder/forego/archive/v${FOREGO_VERSION}.tar.gz sources.tar.gz
|
|
||||||
|
|
||||||
# Move the sources into the right directory
|
RUN git clone https://github.com/nginx-proxy/forego/ \
|
||||||
RUN tar -xzf sources.tar.gz && \
|
&& cd /go/forego \
|
||||||
mkdir -p /go/src/github.com/ddollar/ && \
|
&& git -c advice.detachedHead=false checkout $FOREGO_VERSION \
|
||||||
mv forego-* /go/src/github.com/ddollar/forego
|
&& go mod download \
|
||||||
|
&& CGO_ENABLED=0 GOOS=linux go build -o forego . \
|
||||||
# Install the dependencies and make the forego executable
|
&& go clean -cache \
|
||||||
WORKDIR /go/src/github.com/ddollar/forego/
|
&& mv forego /usr/local/bin/ \
|
||||||
RUN go get -v ./... && \
|
&& cd - \
|
||||||
CGO_ENABLED=0 GOOS=linux go build -o forego .
|
&& rm -rf /go/forego
|
||||||
|
|
||||||
# Build the final image
|
# Build the final image
|
||||||
FROM nginx:1.19.3
|
FROM nginx:1.19.3
|
||||||
@ -56,7 +53,7 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
|||||||
&& sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf
|
&& sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Install Forego + docker-gen
|
# Install Forego + docker-gen
|
||||||
COPY --from=forego /go/src/github.com/ddollar/forego/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
|
# Add DOCKER_GEN_VERSION environment variable
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# setup build arguments for version of dependencies to use
|
# setup build arguments for version of dependencies to use
|
||||||
ARG DOCKER_GEN_VERSION=0.7.6
|
ARG DOCKER_GEN_VERSION=0.7.6
|
||||||
ARG FOREGO_VERSION=0.16.1
|
ARG FOREGO_VERSION=v0.17.0
|
||||||
|
|
||||||
# Use a specific version of golang to build both binaries
|
# Use a specific version of golang to build both binaries
|
||||||
FROM golang:1.15.10-alpine as gobuilder
|
FROM golang:1.15.10-alpine as gobuilder
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git musl-dev
|
||||||
|
|
||||||
# Build docker-gen from scratch
|
# Build docker-gen from scratch
|
||||||
FROM gobuilder as dockergen
|
FROM gobuilder as dockergen
|
||||||
@ -24,19 +24,17 @@ RUN git clone https://github.com/jwilder/docker-gen \
|
|||||||
# Build forego from scratch
|
# Build forego from scratch
|
||||||
FROM gobuilder as forego
|
FROM gobuilder as forego
|
||||||
|
|
||||||
# Download the sources for the given version
|
|
||||||
ARG FOREGO_VERSION
|
ARG FOREGO_VERSION
|
||||||
ADD https://github.com/jwilder/forego/archive/v${FOREGO_VERSION}.tar.gz sources.tar.gz
|
|
||||||
|
|
||||||
# Move the sources into the right directory
|
RUN git clone https://github.com/nginx-proxy/forego/ \
|
||||||
RUN tar -xzf sources.tar.gz && \
|
&& cd /go/forego \
|
||||||
mkdir -p /go/src/github.com/ddollar/ && \
|
&& git -c advice.detachedHead=false checkout $FOREGO_VERSION \
|
||||||
mv forego-* /go/src/github.com/ddollar/forego
|
&& go mod download \
|
||||||
|
&& CGO_ENABLED=0 go build -o forego . \
|
||||||
# Install the dependencies and make the forego executable
|
&& go clean -cache \
|
||||||
WORKDIR /go/src/github.com/ddollar/forego/
|
&& mv forego /usr/local/bin/ \
|
||||||
RUN go get -v ./... && \
|
&& cd - \
|
||||||
CGO_ENABLED=0 GOOS=linux go build -o forego .
|
&& rm -rf /go/forego
|
||||||
|
|
||||||
# Build the final image
|
# Build the final image
|
||||||
FROM nginx:1.19.3-alpine
|
FROM nginx:1.19.3-alpine
|
||||||
@ -47,13 +45,12 @@ RUN apk add --no-cache --virtual .run-deps \
|
|||||||
ca-certificates bash wget openssl \
|
ca-certificates bash wget openssl \
|
||||||
&& update-ca-certificates
|
&& update-ca-certificates
|
||||||
|
|
||||||
|
|
||||||
# Configure Nginx and apply fix for very long server names
|
# Configure Nginx and apply fix for very long server names
|
||||||
RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
RUN echo "daemon off;" >> /etc/nginx/nginx.conf \
|
||||||
&& sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf
|
&& sed -i 's/worker_processes 1/worker_processes auto/' /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Install Forego + docker-gen
|
# Install Forego + docker-gen
|
||||||
COPY --from=forego /go/src/github.com/ddollar/forego/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
|
# Add DOCKER_GEN_VERSION environment variable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user