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

Switch to alpine base image in Dockerfile #177

Closed
2 of 3 tasks
Tracked by #218
fyliu opened this issue Aug 4, 2023 · 5 comments · Fixed by #275
Closed
2 of 3 tasks
Tracked by #218

Switch to alpine base image in Dockerfile #177

fyliu opened this issue Aug 4, 2023 · 5 comments · Fixed by #275
Assignees
Labels
complexity: large Many parts are unexplained and up to the implementer to figure out. feature: infrastructure For changes on site technical architecture role: dev ops s: PD team stakeholder: People Depot Team size: 1pt Can be done in 4-6 hours

Comments

@fyliu
Copy link
Member

fyliu commented Aug 4, 2023

Overview

The current PD docker image is 1.3GB. We should switch to alpine so that we can reduce the image size.

Action Items

  • Use the latest alpine base image
  • Convert rest of Dockerfile to alpine, such as using apk instead of apt

Post Done

Resources/Instructions

@fyliu fyliu added size: 1pt Can be done in 4-6 hours feature: infrastructure For changes on site technical architecture s: PD team stakeholder: People Depot Team role: dev ops labels Aug 4, 2023
@fyliu fyliu added this to the v0.01 - initial setup milestone Aug 4, 2023
@alexlaw528 alexlaw528 self-assigned this Oct 20, 2023
@fyliu fyliu assigned fyliu and unassigned alexlaw528 Mar 22, 2024
@fyliu
Copy link
Member Author

fyliu commented Mar 22, 2024

I'm picking up from where @alexlaw528 left off. This change will make the image smaller and reduce the download required to build the image.

@fyliu
Copy link
Member Author

fyliu commented Mar 25, 2024

I'm able to reduce the image size to 3xxMB by switching to alpine. However, the erd script doesn't work anymore. It generates a junk image.

Considering abandoning image generation for erd, and maybe do it separately on the host or use an online service. Without the erd image generation helpers, the image is 138MB, which is 1/10 the size of the debian-based image.

@fyliu
Copy link
Member Author

fyliu commented Mar 28, 2024

The bad png image was caused by the Roboto font being specified in the .dot file but not being found in the alpine system. It generated the png correctly after I installed the font.

The problem I'm having is that there's not a good way to automate downloading the font when building the image. I manually downloaded and installed it in the container for testing. Maybe the solution is to choose a font that already exists or is easy to install in alpine.

@fyliu
Copy link
Member Author

fyliu commented Apr 5, 2024

I left a message in the django-extensions mailing list but there's no response. I can only assume that Roboto is the designated default font, so I'm checking it into git and installing it into the image at build time so that the erd.png generation can work as before.

The final image size is 203MB on my machine.

I made a PR.

@shmonks shmonks moved this to In progress (actively working) in P: PD: Project Board Jun 7, 2024
@fyliu
Copy link
Member Author

fyliu commented Jun 9, 2024

A couple things happened in the PR thread. We'll need to add these tasks

@fyliu fyliu added complexity: large Many parts are unexplained and up to the implementer to figure out. and removed complexity: missing labels Jul 15, 2024
@github-project-automation github-project-automation bot moved this from 🏗In progress (actively working) to ✅Done in P: PD: Project Board Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: large Many parts are unexplained and up to the implementer to figure out. feature: infrastructure For changes on site technical architecture role: dev ops s: PD team stakeholder: People Depot Team size: 1pt Can be done in 4-6 hours
Projects
Status: ✅Done
3 participants