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

Hackathon - Dockerfile improvements & Github CI docker image publish #3

Merged
merged 26 commits into from
Nov 8, 2024

Conversation

dadatuputi
Copy link
Contributor

Dockerfile Updates

fe8d005 - big update to Dockerfile and local.Dockerfile. Both behave essentially the same way, except Dockerfile uses git to clone the git.xx.network repo.

Using the node:20 base image as a builder and node:20-slim as the production image.

The primary reason, is the original Ubuntu 20 image has loads of vulnerabilities per Docker Scout:

image

The new image (with staging) is about half the size (1.2GB vs 2.6GB) and far fewer vulnerabilities per Docker Scout:

image

Eventually we should move the base image to node:lts but currently there's an issue that is interfering with the build process (see nodejs/docker-node#1946)

Dockerfile tries to use npm ci (which will use package-lock.json) but falls back to npm install, since old branches/tags don't have package-lock.json.

Github Action - Automatically build and publish on v* tags or on-demand

418e0f7 - This action will:

  • Run on any push with a v* tag and publish to ghcr.io with the appropriate tags/metadata
  • Run on-demand on:
    1. github.com - uses local.Dockerfile - check out a specific tag or branch, build and publish
    2. git.xx.network - uses Dockerfile - gets the latest Dockerfile and passes in the branch/tag ref which then builds and publishes

You can see the dockerfiles I've built at https://github.com/dadatuputi/haven/pkgs/container/haven

The process for manual building looks like:

image

Other Commits

b0e10ca - optional npm run script (npm run build:analyze) that will produce some nice artifacts for future optimizations
b6a706a - small optimization to move some dependencies to dev

@dadatuputi dadatuputi force-pushed the hackathon-docker-build branch from 229ce9e to 1c2bb2b Compare November 1, 2024 09:52
@dadatuputi dadatuputi force-pushed the hackathon-docker-build branch from 1c2bb2b to 86a9d7f Compare November 1, 2024 10:37
@dadatuputi
Copy link
Contributor Author

dadatuputi commented Nov 1, 2024

86a9d7f -

Add multi-arch support - linux/amd64 and linux/arm64

Tested for both Dockerfile and local.Dockerfile, results here: https://github.com/dadatuputi/haven/pkgs/container/haven

@rcarback rcarback merged commit ad5d0c2 into xxfoundation:main Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants