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

chore: Optimize docker build oss #3951

Merged
merged 7 commits into from
Jun 12, 2023
Merged

Conversation

gastonfournier
Copy link
Contributor

@gastonfournier gastonfournier commented Jun 9, 2023

About the changes

Reduce the build time of OSS docker image from ~30m to under 15m

  1. Build frontend outside docker multiplatform.
  2. Allow frontend/build to be copied to the image by removing this from .dockerignore
  3. Run with --ignore-scripts to avoid building the frontend on the prepare script, but this requires us to run all the prepare scripts manually (except the frontend build).

Note: we need to build frontend in the prepare script to be able to have source code dependencies

Manual Testing

Manually downloaded from https://hub.docker.com/r/unleashorg/unleash-server/tags?page=1 and compared both unleash folders from main and the version built with the new process https://github.com/Unleash/unleash/actions/runs/5223078089/jobs/9429430190#step:5:48

Screenshot from 2023-06-10 21-11-33

No major difference was spotted (only expected changes due to development done in main)

Command used to extract the contents:

cd /tmp
mkdir main && cd main
docker pull unleashorg/unleash-server:main-edge-18-alpine
docker export $(docker create unleashorg/unleash-server:main-edge-18-alpine) > container.tar && tar xvf container.tar
mkdir ../new-process && cd ../new-process
docker pull unleashorg/unleash-server:sha-ccac902-18-alpine
docker export $(docker create unleashorg/unleash-server:sha-ccac902-18-alpine) > container.tar && tar xvf container.tar
meld ./unleash ../main/unleash

@vercel
Copy link

vercel bot commented Jun 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jun 10, 2023 7:21pm
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Jun 10, 2023 7:21pm

Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comments from Sonatype here make sense. We should probably join the three yarn runs here in a && pipeline. To avoid three temporary images.

platforms: linux/amd64,linux/arm64
push: true
push: ${{ github.event_name != 'workflow_dispatch' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This enables us to run tests on this workflow without pushing the image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I like the opening for running it without pushing to dockerhub

@gastonfournier gastonfournier merged commit 4599e5c into main Jun 12, 2023
10 checks passed
@gastonfournier gastonfournier deleted the optimize-docker-build-oss branch June 12, 2023 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants