Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile files #632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update Dockerfile files #632

wants to merge 1 commit into from

Conversation

phansys
Copy link

@phansys phansys commented Oct 20, 2024

The Dockerfile files were updated with the following changes:

  • Defined version constraints for bundler and rubocop in order to fix dependency resolution at Dockerfile-dev

    Show dependency resolution issue
    $ docker build --file Dockerfile-dev --tag cfn_nag:latest .
    [+] Building 136.8s (8/10)                                                                                                                                                                                                     docker:default
     => [internal] load build definition from Dockerfile-dev                                                                                                                                                                                 0.0s
     => => transferring dockerfile: 196B                                                                                                                                                                                                     0.0s
     => [internal] load metadata for docker.io/library/ruby:2.7-alpine                                                                                                                                                                       1.8s
     => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
     => => transferring context: 2B                                                                                                                                                                                                          0.0s
     => [internal] load build context                                                                                                                                                                                                        0.1s
     => => transferring context: 346.58kB                                                                                                                                                                                                    0.1s
     => CACHED [1/6] FROM docker.io/library/ruby:2.7-alpine@sha256:371668748735a808d1fd1c506878e09f40cb542ffc758cfa7eb124f90827e8d9                                                                                                          0.0s
     => [2/6] COPY . /                                                                                                                                                                                                                       0.2s
     => [3/6] RUN apk add --update build-base     curl     git                                                                                                                                                                               8.3s
     => ERROR [4/6] RUN gem install bundler                                                                                                                                                                                                126.2s
    ------                                                                                                                                                                                                                                        
     > [4/6] RUN gem install bundler:                                                                                                                                                                                                             
    126.0 ERROR:  Error installing bundler:                                                                                                                                                                                                       
    126.0   The last version of bundler (>= 0) to support your Ruby & RubyGems was 2.4.22. Try installing it with `gem install bundler -v 2.4.22`                                                                                                 
    126.0   bundler requires Ruby version >= 3.0.0. The current ruby version is 2.7.8.225.                                                                                                                                                        
    ------
    Dockerfile-dev:9
    --------------------
       7 |         git
       8 |     
       9 | >>> RUN gem install bundler
      10 |     RUN gem install rubocop
      11 |     RUN bundle install
    --------------------
    ERROR: failed to solve: process "/bin/sh -c gem install bundler" did not complete successfully: exit code: 1
    
  • Combined all the executed commands into a single RUN instruction to reduce the number of image layers

  • Added --no-cache option to apk add invocation to reduce image size

  • Added the syntax parser directive to declare the Dockerfile syntax version to use for the build

  • Added labels with pre-defined annotation keys from the OpenContainers Annotations Spec

@phansys phansys requested a review from a team as a code owner October 20, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant