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

feat: added image with nodejs20 #27

Merged
merged 1 commit into from
Jun 25, 2024
Merged

feat: added image with nodejs20 #27

merged 1 commit into from
Jun 25, 2024

Conversation

dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented Jun 25, 2024

PR Type

Enhancement


Description

  • Added a new Dockerfile for Node.js 18 environment with necessary configurations and dependencies.
  • Added a new Dockerfile for Node.js 20 environment with necessary configurations and dependencies.
  • Updated GitHub Actions workflow to include build and publish steps for both Node.js 18 and Node.js 20 Docker images.

Changes walkthrough 📝

Relevant files
Enhancement
publish.yml
Update Docker build and publish steps for Node.js 18 and 20

.github/workflows/publish.yml

  • Added a new build and publish step for Node.js 18 Docker image.
  • Updated existing build and publish step to use Node.js 20 Docker
    image.
  • +15/-1   
    18.Dockerfile
    Add Dockerfile for Node.js 18 environment                               

    18.Dockerfile

  • Created Dockerfile for Node.js 18.
  • Set up environment variables and installed necessary packages.
  • Configured pnpm and copied server files.
  • +45/-1   
    20.Dockerfile
    Add Dockerfile for Node.js 20 environment                               

    20.Dockerfile

  • Created Dockerfile for Node.js 20.
  • Set up environment variables and installed necessary packages.
  • Configured pnpm and copied server files.
  • +44/-0   

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review [1-5] 3
    🧪 Relevant tests No
    🔒 Security concerns No
    ⚡ Key issues to review Possible Bug:
    The Dockerfile configurations for Node.js 18 and Node.js 20 are identical except for the base image. If there are specific dependencies or configurations needed for Node.js 20, they should be addressed.
    Optimization Suggestion:
    The Dockerfiles use apk update and apk upgrade which can lead to non-deterministic builds. Consider pinning versions of packages to ensure consistent environments.
    Code Duplication:
    The Dockerfiles for Node.js 18 and 20 are almost identical. Consider using a base Dockerfile with ARGs for versions to reduce duplication and ease maintenance.

    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Performance
    Add Docker layer caching to speed up the build process

    Consider adding a cache-from parameter to the Docker build step to leverage Docker layer
    caching, which can significantly speed up the build process by reusing layers from
    previous builds.

    .github/workflows/publish.yml [51-59]

     with:
       context: .
       platforms: linux/amd64,linux/arm64
       push: ${{ github.event_name != 'pull_request' }}
       tags: ${{ steps.meta.outputs.tags }}
       labels: 18-${{ steps.meta.outputs.labels }}
       file: 18.Dockerfile
    +  cache-from: type=registry,ref=myrepo/myimage:cache
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Adding a cache-from parameter can significantly improve build times by reusing layers, which is a substantial performance enhancement.

    8
    Combine apk update and apk upgrade commands to optimize the Docker image size

    Combine the apk update and apk upgrade commands into a single RUN command to reduce the
    number of layers in the Docker image, which can help in optimizing the image size.

    18.Dockerfile [29-30]

    -RUN apk update && apk upgrade && \
    -    apk add --no-cache git openssh python3 make g++
    +RUN apk update && apk upgrade && apk add --no-cache git openssh python3 make g++
     
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The suggestion correctly identifies an optimization in Dockerfile commands to reduce layers, but the existing and improved code snippets are identical, suggesting a misunderstanding in the suggestion's presentation.

    5
    Enhancement
    Add continue-on-error to Docker build steps to allow workflow continuation on failure

    Add a continue-on-error: true parameter to the Docker build steps to ensure that the
    workflow continues even if the Docker build fails, which can be useful for non-critical
    builds.

    .github/workflows/publish.yml [66-70]

     with:
       context: .
       platforms: linux/amd64,linux/arm64
       push: ${{ github.event_name != 'pull_request' }}
       tags: ${{ steps.meta.outputs.tags }}
       labels: 20-${{ steps.meta.outputs.labels }}
       file: 20.Dockerfile
    +  continue-on-error: true
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Adding continue-on-error is beneficial for non-critical builds to ensure workflow continuity, enhancing robustness and usability of the CI/CD pipeline.

    7

    @dbarrosop dbarrosop merged commit e16da18 into main Jun 25, 2024
    1 check passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants