devtron-labs / silver-surfer

Kubernetes objects api-version compatibility checker and provides migration path for K8s objects and prepare it for cluster upgrades
https://devtron.ai/
Apache License 2.0
356 stars 37 forks source link

fix: failing docker builds #24

Closed notsatan closed 3 years ago

notsatan commented 3 years ago

The Problem

As mentioned in #23, docker builds were failing with the error message

Error response from daemon: failed to parse Dockerfile: ENV must have two arguments

The cause of the issue was that the ENV command in dockerfile expects two values - the name of the environment variable, and its value. The GITHUB_TOKEN environment variable had no value set against it, causing docker builds to fail

https://github.com/devtron-labs/silver-surfer/blob/45804592c4062d603bec137802a37003e6a4341a/Dockerfile#L9

The Fix

This PR resolves #23

Added a new build argument named AUTH_TOKEN that would then be set as the value for the GITHUB_TOKEN environment variable in dockerfile

Updated the docker build command in README!

notsatan commented 3 years ago

Given that the GITHUB_TOKEN environment variable is needed by the docker image during runtime (and is not optional), I'm thinking of making it be mandatory in the dockerfile - i.e. docker builds would fail if the variable is not set with the build command.

notsatan commented 3 years ago

@Abhinav-26 this should fix the issue with failing docker builds.

I've also modified the dockerfile to ensure that the docker build command fails if AUTH_TOKEN (which will be used to set the GITHUB_TOKEN env variable) is not provided

https://github.com/devtron-labs/silver-surfer/blob/e3b3dfb8f675ae679e9375419dc86929c2545070/Dockerfile#L10

If this is not needed, or should be a separate issue/PR by itself - let me know, I'll selectively roll this commit back!

arushi09-hub commented 3 years ago

Hi There, We thank you for your valuable contributions. Please follow the steps below for the Giveaways Entry -

  1. Once the PR is raised you can join the discord community for the upcoming updates.
  2. After joining the community, send your PR link on the #contrib channel with the tag @hacktoberfest.
  3. We will evaluate the PR and once it is accepted , we will send you the swags.