mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
[PR #932] [MERGED] Rootless Docker/Optimized build #1065
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pelican-dev/panel/pull/932
Author: @PseudoResonance
Created: 1/19/2025
Status: ✅ Merged
Merged: 1/23/2025
Merged by: @alexevladgabriel
Base:
main← Head:rootless-docker📝 Commits (8)
0ddf5c8Rootless Dockerfile/Optimized build74f65c9Remove install-php-extensions utility after use and name final stage20e46b5Test arm64 runnered1473fAllow Docker workflow caching multi-arch separatelyfd3cce2Fix Docker publish workflow branches30f765eMove Caddyfile/crontab config into docker directory, remove redundant supervisord user6de2a72Further restrict permissions0336e55Supervisord logs📊 Changes
9 files changed (+115 additions, -64 deletions)
View changed files
📝
.dockerignore(+22 -3)📝
.github/workflows/docker-publish.yml(+4 -2)📝
Dockerfile(+71 -35)📝
compose.yml(+1 -0)📝
docker/Caddyfile(+0 -0)📝
docker/README.md(+0 -0)➕
docker/crontab(+1 -0)📝
docker/entrypoint.sh(+4 -16)📝
docker/supervisord.conf(+12 -8)📄 Description
This is a replacement for #894
Changes
Ex: The stages 2-1, 2-2 can run independently of each other, and so can 3-1 and 3-2.
It's generally important to not simply discard all logs. Let the Docker host handle logfile rotation if using file logging, or let the host redirect to their desired log processor, such as Grafana Loki.
The majority of the build should ideally be left as root, so that in the event there is a vulnerability, the user would be unable to easily overwrite the working code. I don't think there's a good solution to the Laravel cache however.
Additional Information
As in #894, I separated the install/build stages for Composer/Yarn so that the install stage can be skipped from cache if the code is unchanged. I know there were questions about it in the last PR, but this is standard practice in Dockerfiles. First copy the list of dependencies to install and install them, then copy the remainder of the code.
After these changes, I was able to iterate on the build process and rebuild the docker image in mere seconds, compared to the several minutes it took previously, as the whole image had to be rebuilt every time because the code was copied early on.
Important Note
I am using
COPY --exclude=Caddyfile --exclude=docker/ . ./to copy files, which is a new addition to the Dockerfile copy directive which is currently only present in the 1.7 labs spec of Dockerfile. It's been around for a year now and I don't expect this basic use of it to break. This does require declaring the 1.7-labs spec at the top of the file though, which should eventually be removed when exclude is merged to stable.Other Options
Instead of using supercronic and supervisord and everything to run as non-root, sidecar containers can also be added. This is how some other projects, like Nextcloud, deal with running cron tasks, and running a more configurable HTTP server.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.