Skip to content

Autocreate and Tag Docker Images for Main - #654

Draft
Division7 wants to merge 13 commits into
mainfrom
dj-createAndTagDockerfile
Draft

Autocreate and Tag Docker Images for Main#654
Division7 wants to merge 13 commits into
mainfrom
dj-createAndTagDockerfile

Conversation

@Division7

@Division7 Division7 commented May 22, 2026

Copy link
Copy Markdown
Member

In this PR, I create work off of #653 and create a multi-stage Dockerfile. The second stage is a minimum-size file consisting solely of the jar and startup script, no longer containing a full copy of the repository, which should be unnecessary past packaging. It is separated into two parts:
Builder actually builds the app from source. Because every command in Docker is a "layer", things that change less often are copied earlier: the pom.xml is copied first and maven downloads its' dependencies so that they do not need to be redownloaded every time. Then, package.json and package-lock.json are copied over and the dependencies are downloaded & installed: I use the maven backend goals for this so that it doesn't attempt to redownload maven during the packaging process. From there, everything else is copied over and the app is packaged. This prevents having to redownload unchanged dependencies.

The jar and startup script are then copied to a minified environment containing just a JRE and running on alpine.

From there, I add a workflow that on push to main will automatically build and tag a docker image for Frontiers; this will allow us to set dokku to track the ghcr.io/ucsb-cs156/proj-frontiers:main image. When we merge changes into main, Frontiers can then automatically redeploy.

I've temporarily deleted the created package ran by the workflow as the organization currently has packages marked as private-only and I don't want to incur billing.

Example mostly created by following this: https://docs.github.com/en/actions/tutorials/publish-packages/publish-docker-images#publishing-images-to-docker-hub-and-github-packages

Notably, splitting off the workflow into cacheable sections reduces time to ~2mins (not including cache reupload time)

First build time: 140s

Second build time: ~89s

Deployed to https://frontiers-qa1.dokku-00.cs.ucsb.edu/

Merge after #653

@Division7 Division7 self-assigned this May 22, 2026
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