openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

Duplicated copy line in Dockerfile #108

Closed itsksaurabh closed 3 years ago

itsksaurabh commented 3 years ago

Expected Behaviour

Current Behaviour

There are some areas of improvement in the current Dockerfile:

1. Repeats similar build steps ( layers ). It can be seen here.

COPY metrics             metrics
COPY metrics             metrics

2. Build Args are there but not used anywhere inside the Dockerfile which can be seen here.

Possible Solution

Possible solutions:

1. Remove extra similar layers as it is not required.

2. Use the build args inside the Dockerfile for dynamic builds. For example :

ARG CGO_ENABLED=0
........
............
# Stripping via -ldflags "-s -w" 
RUN CGO_ENABLED=$CGO_ENABLED GOOS=linux go build -a -ldflags "-s -w" -installsuffix cgo -o of-watchdog . \
.......
..............

Steps to Reproduce (for bugs)

none

Context

Your Environment

alexellis commented 3 years ago

/set title: Duplicated copy line in Dockerfile

alexellis commented 3 years ago

Happy for you to send a PR to remove the duplicated line. the ARGS can be changed to ENV if they are not used.

itsksaurabh commented 3 years ago

@alexellis Thanks for the review. I am removing that duplicated copy of the line from the Dockerfile with my PR. Before changing ARGS to ENV, I would like to discuss it in the slack channel. :)